Exemple #1
0
        public void DiscountForEmptyCart()
        {
            var cart = CommonInstansesCreator.GetCart();

            var discount = new CartDiscount(cart, 50);

            Assert.Equal(0, discount.GetCost());
        }
Exemple #2
0
        public void DiscountWorks()
        {
            var cart = CommonInstansesCreator.GetCart();
            var productRepository = CommonInstansesCreator.GetProductRepo();
            var product           = productRepository.FirstOrDefault();

            var item = new CartItem {
                Count = 2, Product = product
            };

            cart.AddProduct(new ProductDiscount(item, 50));

            Assert.Equal(product.Cost, cart.GetCost());
        }