Exemplo n.º 1
0
        public void DiscountForEmptyCart()
        {
            var cart = CommonInstansesCreator.GetCart();

            var discount = new CartDiscount(cart, 50);

            Assert.Equal(0, discount.GetCost());
        }
Exemplo n.º 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());
        }