public void GetBillProducts_TwoSameProductsDueDiffAmount_ReturnsTwoProducts(int addHours) { var plans = new List <ApiPaymentPlan>() { new ApiPaymentPlan() { Id = 1, ProductName = ProductNameA, NextChargeDate = NowMonth, PricePerPeriod = ProductPrice, PeriodUnit = PaymentPeriodUnit.MonthPostpaid }, new ApiPaymentPlan() { Id = 2, ProductName = ProductNameA, NextChargeDate = NowMonth, PricePerPeriod = ProductPrice, PeriodUnit = PaymentPeriodUnit.MonthPostpaid, StartDate = NowMonth.AddDays(-15) } }; var result = Model.GetBillProducts(CreateContact(), plans, _now.AddHours(addHours)); Assert.Equal(2, result.Count); Assert.Equal(ProductNameA, result[0].Name); Assert.Equal(ProductPrice, result[0].Price); Assert.Equal(1, result[0].Quantity); Assert.Equal(ProductNameA, result[1].Name); Assert.InRange(result[1].Price, ProductPrice * .4m, ProductPrice * .6m); Assert.Equal(1, result[1].Quantity); }
public void GetBillProducts_PostpaidDueThreeHalfMonths_ReturnsThreeHalfPrice(int addHours) { var plans = new List <ApiPaymentPlan>() { new ApiPaymentPlan() { Id = 1, NextChargeDate = NowMonth.AddMonths(-2), PricePerPeriod = ProductPrice, PeriodUnit = PaymentPeriodUnit.MonthPostpaid, StartDate = NowMonth.AddDays(-106) } }; var result = Model.GetBillProducts(CreateContact(), plans, _now.AddHours(addHours)); Assert.Single(result); Assert.InRange(result[0].Price, ProductPrice * 3.4m, ProductPrice * 3.6m); Assert.Equal(1, result[0].Quantity); }