Esempio n. 1
0
        public void TestForScenarioA()
        {
            var itemA = _itemFactory.GetItem("A");

            itemA.Count = 1;
            var itemB = _itemFactory.GetItem("B");

            itemB.Count = 1;
            var itemC = _itemFactory.GetItem("C");

            itemC.Count = 1;
            var order = new Order();

            order.OrderItems.Add(itemA);
            order.OrderItems.Add(itemB);
            order.OrderItems.Add(itemC);

            order = _promotionFactory.ApplyPromotion(order);

            var invoiceAmount = _invoiceFactory.CalculateTotalInvoiceAmount(order);

            Assert.AreEqual(100, invoiceAmount);
        }
Esempio n. 2
0
        public void TestUsingOrderItemForInvoiceGeneration()
        {
            var itemA = new OrderItem {
                SkuId = "A", Count = 1, Price = 10
            };
            var itemB = new OrderItem {
                SkuId = "B", Count = 1, Price = 10
            };
            var itemC = new OrderItem {
                SkuId = "C", Count = 1, Price = 10
            };
            var itemD = new OrderItem {
                SkuId = "D", Count = 1, Price = 10
            };
            var order = new Order();

            order.OrderItems.Add(itemA);
            order.OrderItems.Add(itemB);
            order.OrderItems.Add(itemC);
            order.OrderItems.Add(itemD);
            var invoiceAmount = _invoiceFactory.CalculateTotalInvoiceAmount(order);

            Assert.AreEqual(40, invoiceAmount);
        }