Ejemplo n.º 1
0
        public void TestMethod3()
        {
            Cashier cashier = new Cashier("En");

            Product appleEn = new Product() { Name = "Apple",CountryCode="En",TranslationName="Apple", Price = 100 };
            Product appleFr = new Product() { Name = "Apple", CountryCode = "Fr", TranslationName = "Pomme", Price = 100 };

            Product cherrie = new Product() { Name = "Cherrie", CountryCode = "En", Price = 75 };
            Product banana = new Product() { Name = "Banana", CountryCode = "En", Price = 150 };

            cashier.AddPromotion(new Promotion()
            {
                ProductName = "Cherrie",
                Remise = 30,
                QuantityTrigger = 2,
                CountryCode = "En"
            });
            cashier.AddPromotion(new Promotion()
            {
                ProductName = "Banana",
                Remise = 150,
                QuantityTrigger = 2,
                CountryCode = "En"
            });

            cashier.Add(appleEn);
            cashier.Add(cherrie);
            cashier.Add(cherrie);
            cashier.Add(banana);
            cashier.Add(banana);

            Assert.AreEqual("370", cashier.ToString());
        }
Ejemplo n.º 2
0
        public void TestMethod1()
        {
            Cashier cashier = new Cashier();

            Product apple = new Product(){Name="Apple",Price=100};
            Product cherrie = new Product(){Name="Cherrie",Price=75};
            Product banana = new Product(){Name="Banana",Price=150};

            cashier.Add(apple);
            cashier.Add(cherrie);
            cashier.Add(banana);

            Assert.AreEqual("325", cashier.ToString());
        }
Ejemplo n.º 3
0
        public void TestMethod2()
        {
            Cashier cashier = new Cashier();

            Product apple = new Product() { Name = "Apple", Price = 100 };
            Product cherrie = new Product() { Name = "Cherrie", Price = 75 };
            Product banana = new Product() { Name = "Banana", Price = 150 };

            cashier.AddPromotion(new Promotion()
            {
                ProductName = "Cherrie",
                Remise = 20,
                QuantityTrigger = 2
            });

            cashier.Add(apple);
            cashier.Add(cherrie);
            cashier.Add(cherrie);
            cashier.Add(banana);

            Assert.AreEqual("380", cashier.ToString());
        }