using After;
namespace BeforeAfter.Tests.TestData;
///
/// Test data builder for an (TestDataBuilder pattern).
/// starts from a fresh order —
/// id, empty description, zero total, exactly what
/// new Order() gives — and every With... returns the builder for
/// chaining; hands back the order.
///
/// This class is the only place tests touch an order's *construction*: when
/// the domain evolves (e.g. OrderLines making the total computed), only these
/// internals change and the tests keep reading the same.
///
public sealed class OrderBuilder
{
private readonly Order _order = new();
/// A valid, fresh order — the neutral starting point for tests.
public static OrderBuilder ValidOrder() => new();
public OrderBuilder WithId(Guid id)
{
_order.Id = id;
return this;
}
public OrderBuilder WithDescription(string description)
{
_order.Description = description;
return this;
}
///
/// Sets the total in cents (150_00 = €150.00). How the requested
/// total is realised inside the order is an implementation detail that may
/// change as the domain evolves; this API stays.
///
public OrderBuilder WithTotal(int totalInCents)
{
_order.TotalInCents = totalInCents;
return this;
}
public Order Build() => _order;
}