Exemple #1
0
        public void USDNoDiscount_CalculateProductTotal_Return49_9()
        {
            IoCContainer.AddService <IRate, USD>();
            IoCContainer.AddService <IDiscount, NoDiscount>();
            ShoppingCart cart = new ShoppingCart();

            cart.Products = cart.Products.Concat(new Product[] { new Product {
                                                                     Price = 100
                                                                 } });

            var res = cart.CalculateProductTotal();

            Assert.Equal(49M, res);
        }
Exemple #2
0
        public void BYNDiscount10_CalculateProductTotal_Return90()
        {
            IoCContainer.AddService <IRate, BYN>();
            IoCContainer.AddService <IDiscount, Discount10>();
            ShoppingCart cart = new ShoppingCart();

            cart.Products = cart.Products.Concat(new Product[] { new Product {
                                                                     Price = 100
                                                                 } });

            var res = cart.CalculateProductTotal();

            Assert.Equal(90, res);
        }
Exemple #3
0
        public void USD10Discount_CalculateProductTotal_Return441_17()
        {
            IoCContainer.AddService <IRate, USD>();
            IoCContainer.AddService <IDiscount, Discount10>();
            ShoppingCart cart = new ShoppingCart();

            cart.Products = cart.Products.Concat(new Product[] { new Product {
                                                                     Price = 600
                                                                 }, new Product {
                                                                     Price = 400
                                                                 } });

            var res = cart.CalculateProductTotal();

            Assert.Equal(441M, res);
        }