using PowderCoating.Core.Accounting; namespace PowderCoating.UnitTests; public class RefundAllocationTests { [Theory] [InlineData(108, 8, 108, 100, 8)] // full refund, proportional tax [InlineData(54, 8, 108, 50, 4)] // half refund → half the tax [InlineData(100, 0, 100, 100, 0)] // no tax on the invoice [InlineData(100, 8, 0, 100, 0)] // zero invoice total → all returns, no tax public void Split_AllocatesTaxProportionally_AndAlwaysSumsToRefund( decimal amount, decimal invoiceTax, decimal invoiceTotal, decimal expectedReturns, decimal expectedTax) { var (returns, tax) = RefundAllocation.Split(amount, invoiceTax, invoiceTotal); Assert.Equal(expectedReturns, returns); Assert.Equal(expectedTax, tax); // Invariant: the two portions must always reconstruct the refund exactly (no penny lost). Assert.Equal(amount, returns + tax); } }