public void ThreeItemsDiscountTypeFourItemTest()
        {
            var productCodes = new List <string> {
                "code1", "code2"
            };
            var discountType = new ThreeItemsDiscountType(GetDiscount(productCodes));
            var lineItems    = new List <ILineItem>
            {
                new StandardLineItem {
                    Price = 1, ProductCode = "code1", SubTotal = 1, Total = 1
                },
                new StandardLineItem {
                    Price = 1, ProductCode = "code2", SubTotal = 1, Total = 1
                },
                new StandardLineItem {
                    Price = 1, ProductCode = "code1", SubTotal = 1, Total = 1
                },
                new StandardLineItem {
                    Price = 1, ProductCode = "code1", SubTotal = 1, Total = 1
                },
            };

            discountType.Calculate(lineItems);
            Assert.Equal(1, lineItems[0].Total);
            Assert.Equal(0.34, lineItems[1].Total);
            Assert.Equal(0.33, lineItems[2].Total);
            Assert.Equal(0.33, lineItems[3].Total);
        }
        public void ThreeItemsDiscountTypeAlreadyDiscountedTest()
        {
            var productCodes = new List <string> {
                "code1", "code2"
            };
            var discountType      = new ThreeItemsDiscountType(GetDiscount(productCodes));
            var originalLineItems = new List <ILineItem>
            {
                new StandardLineItem {
                    Price = 1, ProductCode = "code1", SubTotal = 1, Total = 0.5
                },
                new StandardLineItem {
                    Price = 1, ProductCode = "code2", SubTotal = 1, Total = 1
                },
                new StandardLineItem {
                    Price = 1, ProductCode = "code1", SubTotal = 1, Total = 1
                },
            };

            var lineItems = new List <ILineItem>();

            originalLineItems.ForEach(lineItems.Add);

            discountType.Calculate(lineItems);
            Assert.Equal(originalLineItems, lineItems);
        }
        public void ThreeItemsDiscountTypeNegativeTest()
        {
            var discountType = new ThreeItemsDiscountType(GetDiscount());

            discountType.Calculate(null);
            discountType.Calculate(new List <ILineItem>());
        }