Пример #1
0
        public void PromotionEngineTest_CalculateWrongTotal()
        {
            //Arrange
            int actualTotal = 270;
            Dictionary <string, int> userCart = new Dictionary <string, int>();

            userCart.Add("A", 5);
            PromotionEngine pe = new PromotionEngine();

            //Act
            int total = pe.CalculateTotalAfterPromotions(userCart);

            //Assert
            Assert.AreEqual(actualTotal, total, 0, "Wrong Total");
        }
Пример #2
0
        static void Main(string[] args)
        {
            Dictionary <string, int> CustomerOrders = new Dictionary <string, int>();
            string input;

            Console.WriteLine("Enter the product and quanity by comma seperated");
            for (int i = 0; i < 4; i++)
            {
                input = Console.ReadLine();
                string[] words = input.Split(',');
                CustomerOrders.Add(words[0].ToUpper(), Convert.ToInt32(words[1]));
            }
            PromotionEngine pe = new PromotionEngine();

            Console.WriteLine(pe.CalculateTotalAfterPromotions(CustomerOrders));
            Console.ReadKey();
        }
Пример #3
0
        public void PromotionEngineTest_CalculateTotal()
        {
            //Arrange
            int actualTotal = 205;
            Dictionary <string, int> userCart = new Dictionary <string, int>();

            userCart.Add("A", 3);
            userCart.Add("B", 2);
            userCart.Add("C", 1);
            userCart.Add("D", 1);
            PromotionEngine pe = new PromotionEngine();

            //Act
            int total = pe.CalculateTotalAfterPromotions(userCart);

            //Assert
            Assert.AreEqual(actualTotal, total, 0, "Correct Total");
        }