public void TestCase2() { var order = new SalesOrder(); order.AddOrderLine(CreateOrderLine("�ɿ���", "��", "Food", 10.00m, true)); order.AddOrderLine(CreateOrderLine("��ˮ", "ƿ", "Others", 47.50m, true)); Assert.AreEqual(10.50m, order.OrderLines[0].GetAfterTaxAmount()); Assert.AreEqual(54.65m, order.OrderLines[1].GetAfterTaxAmount()); Assert.AreEqual(7.65m, order.GetTotalTax()); Assert.AreEqual(65.15m, order.GetTotalAfterTaxAmount()); }
public void Can_Get_Total_Tax() { var order = new SalesOrder(); order.AddOrderLine(CreateMockOrderLine(1.55m, 2.55m, 4.10m)); order.AddOrderLine(CreateMockOrderLine(2.93m, 1.10m, 4.03m)); decimal totalBeforeTax = order.GetTotalBeforeTaxAmount(); decimal totalTax = order.GetTotalTax(); decimal totalAfterTax = order.GetTotalAfterTaxAmount(); Assert.AreEqual(1.55m + 2.93m, totalBeforeTax); Assert.AreEqual(2.55m + 1.10m, totalTax); Assert.AreEqual(4.10m + 4.03m, totalAfterTax); }
public void TestCase1() { var order = new SalesOrder(); order.AddOrderLine(CreateOrderLine("��", "Books", 12.49m)); order.AddOrderLine(CreateOrderLine("CD", "Others", 14.99m)); order.AddOrderLine(CreateOrderLine("�ɿ���", "��", "Food", 0.85m, false)); Assert.AreEqual(12.49m, order.OrderLines[0].GetAfterTaxAmount()); Assert.AreEqual(16.49m, order.OrderLines[1].GetAfterTaxAmount()); Assert.AreEqual(0.85m, order.OrderLines[2].GetAfterTaxAmount()); Assert.AreEqual(1.5m, order.GetTotalTax()); Assert.AreEqual(29.83m, order.GetTotalAfterTaxAmount()); }
public void TestCase3() { var order = new SalesOrder(); order.AddOrderLine(CreateOrderLine("��ˮ", "ƿ", "Others", 27.99m, true)); order.AddOrderLine(CreateOrderLine("��ˮ", "ƿ", "Others", 18.99m ,false)); order.AddOrderLine(CreateOrderLine("ͷʹҩ", "��", "Medicine", 9.75m, false)); order.AddOrderLine(CreateOrderLine("�ɿ���", "��", "Food", 11.25m, true)); Assert.AreEqual(32.19m, order.OrderLines[0].GetAfterTaxAmount()); Assert.AreEqual(20.89m, order.OrderLines[1].GetAfterTaxAmount()); Assert.AreEqual(9.75m, order.OrderLines[2].GetAfterTaxAmount()); Assert.AreEqual(11.85m, order.OrderLines[3].GetAfterTaxAmount()); Assert.AreEqual(6.70m, order.GetTotalTax()); Assert.AreEqual(74.68m, order.GetTotalAfterTaxAmount()); }