public void AddPercentageVoucher() { Order order=new Order{ VoucherPercentage = 10, VoucherId=1 }; List<OrderLine> orderLines = new List<OrderLine>(); orderLines.Add(new OrderLine{ Quantity=1, PaymentAmount=10 }); order.OrderLines = orderLines; Assert.IsTrue(order.GetVoucherTotal()==1); Debug.WriteLine(order.GetVoucherDetail().Detail); }
public void AddPerItemVoucherWithProductCategoryFilter() { Order order = new Order { VoucherPerItemAmount = 1, VoucherProductCategoryFilter = "TEST1", VoucherId = 1 }; List<OrderLine> orderLines = new List<OrderLine>(); orderLines.Add(new OrderLine { ProductCategory = "TEST1CATEGORY", Quantity = 1, PaymentAmount = 10, ProductTitle = "Test Product 1 for Voucher" }); orderLines.Add(new OrderLine { ProductCategory = "TEST2CATEGORY", Quantity = 1, PaymentAmount = 10, ProductTitle = "Test Product 2 for Voucher" }); order.OrderLines = orderLines; Assert.IsTrue(order.GetVoucherTotal() == 1); Debug.WriteLine(order.GetVoucherDetail().Detail); }
public void AddPerItemVoucherWithMiniumPayment() { Order order = new Order { VoucherPerItemAmount = 1, VoucherMinimumPayment=25, VoucherId = 1 }; List<OrderLine> orderLines = new List<OrderLine>(); orderLines.Add(new OrderLine { Quantity = 1, PaymentAmount = 10, ProductTitle = "Test Product 1 for Voucher" }); orderLines.Add(new OrderLine { Quantity = 1, PaymentAmount = 10, ProductTitle = "Test Product 2 for Voucher" }); order.OrderLines = orderLines; Assert.IsTrue(order.GetVoucherTotal() == 0); Debug.WriteLine(order.GetVoucherDetail().Detail); }
public void ShouldHavePositiveVoucherTotalWithMoreThanMiniumItems() { Order order = new Order { VoucherPerItemAmount = 1, VoucherMinimumItems = 1, VoucherId = 1 }; List<OrderLine> orderLines = new List<OrderLine>(); orderLines.Add(new OrderLine { Quantity = 2, PaymentAmount = 10 }); orderLines.Add(new OrderLine { Quantity = 2, PaymentAmount = 10 }); order.OrderLines = orderLines; Assert.IsTrue(order.GetVoucherTotal() == 4); Debug.WriteLine(order.GetVoucherDetail().Detail); }