public void Unit_Should_Be_DefaultUnit_If_Not_Specified() { var orderLine1 = new OrderLine(_stubSaleItem); var orderLine2 = new OrderLine(_stubSaleItem, 2); Assert.AreSame(_stubSaleItem.Product.Units[0], orderLine1.ItemUnit); Assert.AreSame(_stubSaleItem.Product.Units[0], orderLine2.ItemUnit); }
public void Can_Get_TotalTax_Correctly() { var mockProduct1 = new Mock<ISaleItem>(); mockProduct1.Setup(x => x.GetTax()).Returns(1.50m); var orderLine = new OrderLine(mockProduct1.Object, 10); decimal totalTax = orderLine.GetTotalTax(); Assert.AreEqual(15.0m, totalTax); }
public void Can_Get_BeforeTax_Amount_Correctly() { var mockProduct1 = new Mock<ISaleItem>(); mockProduct1.SetupGet(x => x.Price).Returns(11.50m); var orderLine = new OrderLine(mockProduct1.Object, 10); decimal totalTax = orderLine.GetBeforeTaxAmount(); Assert.AreEqual(115.0m, totalTax); }
public void Can_Get_AfterTax_Amount_Correctly() { var mockProduct1 = new Mock<ISaleItem>(); mockProduct1.Setup(x => x.GetTax()).Returns(12.99m); mockProduct1.SetupGet(x => x.Price).Returns(11.50m); var orderLine = new OrderLine(mockProduct1.Object, 10); decimal totalAmount = orderLine.GetAfterTaxAmount(); Assert.AreEqual(244.90m, totalAmount); }
public void Quantity_Should_Be_One_If_Not_Specified() { var orderLine = new OrderLine(_stubSaleItem); Assert.AreEqual(1, orderLine.Quantity); }
public void AddOrderLine(OrderLine orderLine) { OrderLines.Add(orderLine); }