using After;
namespace BeforeAfter.Tests.TestData;
///
/// Test data builder for a with its orders
/// (TestDataBuilder pattern). starts from a
/// fresh client, exactly what new Client() gives.
///
public sealed class ClientBuilder
{
private readonly Client _client = new();
/// A valid, fresh client — the neutral starting point for tests.
public static ClientBuilder ValidClient() => new();
public ClientBuilder WithId(Guid id)
{
_client.Id = id;
return this;
}
public ClientBuilder WithName(string name)
{
_client.Name = name;
return this;
}
/// Adds an order to the client (navigation fix-up wires the back-reference).
public ClientBuilder WithOrder(Order order)
{
_client.Orders.Add(order);
return this;
}
/// Builds the given builder and adds its order — chaining sugar for .WithOrder(builder.Build()).
public ClientBuilder WithOrder(OrderBuilder order) => WithOrder(order.Build());
public Client Build() => _client;
}