Files
ai-code-exploration/src/Before/WebApp.cs
T
mostalive d60ea160c4 rewrite comments in neutral, terse style
Doc comments, inline comments, and README no longer editorialize about
the code (ActiveRecord, leak, fake, Yak before/after). They now describe
behavior only. Test A_client_can_reach_its_DbContext__the_leak renamed
to A_client_can_reach_its_DbContext. No behavior changes; all 27 tests
pass.
2026-09-15 17:26:15 +01:00

29 lines
852 B
C#

namespace Before;
/// <summary>
/// Consumes <see cref="Client"/> and <see cref="Order"/> domain objects
/// directly.
/// </summary>
public class WebApp
{
/// <summary>
/// Returns the client's name, id, and orders formatted as text.
/// </summary>
public string ShowClient(Client client)
{
ArgumentNullException.ThrowIfNull(client);
var lines = new List<string> { $"{client.Name} [{client.Id}]" };
foreach (var order in client.Orders)
lines.Add($" - order [{order.Id}]: {order.Description}");
return string.Join(Environment.NewLine, lines);
}
/// <summary>Returns true when the client is attached to a context.</summary>
public bool IsPersisted(Client client)
{
ArgumentNullException.ThrowIfNull(client);
return client.DbContext is not null;
}
}