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

            var discount = new CartDiscount(cart, 50);

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

            cart.AddProduct(new CartItem {
                Count = 2, Product = product
            });

            var discount = new CartDiscount(cart, 50);

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