示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        public void Quantity_Should_Be_One_If_Not_Specified()
        {
            var orderLine = new OrderLine(_stubSaleItem);

            Assert.AreEqual(1, orderLine.Quantity);
        }
示例#6
0
 public void AddOrderLine(OrderLine orderLine)
 {
     OrderLines.Add(orderLine);
 }