Exemple #1
0
        public void CreateProductDiscountLineItems_WithInvalidDiscounts_CreatesZeroLineItems(Product product)
        {
            PopulateOrder(product, 5);

            var lineItems = InvoiceFactory.CreateProductDiscountLineItems(product, _order.ScannedItems);

            lineItems.Count().Should().Be(0);
        }
Exemple #2
0
        public void CreateProductDiscountLineItems_CreatesSpecialLineItems(decimal retailPrice, Special special, int scannedItemCount, int expectedLineItemCount, decimal expectedValue)
        {
            var product = new Product("product with special", Money.USDollar(retailPrice), SellByType.Unit)
            {
                Special = special
            };

            PopulateOrder(product, scannedItemCount);
            var discountLineItems = InvoiceFactory.CreateProductDiscountLineItems(product, _order.ScannedItems);
            var specialLineItems  = discountLineItems.Where(x => x.GetType() == typeof(SpecialLineItem)).ToList();

            specialLineItems.Count().Should().Be(expectedLineItemCount);
            specialLineItems.Sum(x => x.SalePrice.Amount).Should().Be(expectedValue);
        }
Exemple #3
0
        public void CreateProductDiscountLineItems_CreatesMarkdownLineItems(Markdown markdown, Special special, int scannedItemCount, int expectedLineItemCount, decimal expectedValue)
        {
            var product = new Product("test product", Money.USDollar(1m), SellByType.Unit)
            {
                Markdown = markdown,
                Special  = special
            };

            PopulateOrder(product, scannedItemCount);
            var discountLineItems = InvoiceFactory.CreateProductDiscountLineItems(product, _order.ScannedItems);
            var markdownLineItems = discountLineItems.Where(x => x.GetType() == typeof(MarkdownLineItem)).ToList();

            markdownLineItems.Count().Should().Be(expectedLineItemCount);
            markdownLineItems.Sum(x => x.SalePrice.Amount).Should().Be(expectedValue);
        }