Example #1
0
 public void TestMethod2()
 {
     var cart = new Cart();
     cart.AddItem("FR1");
     cart.AddItem("FR1");
     Assert.AreEqual(cart.GetTotal(), 3.11, 0.001, "Test 2 (FR1, FR1) Failed");
 }
Example #2
0
        private static void TestExamples()
        {
            var cart = new Cart();
            cart.AddItem("Cart 1");
            cart.AddItem("FR1");
            cart.AddItem("SR1");
            cart.AddItem("FR1");
            cart.AddItem("FR1");
            cart.AddItem("CF1");
            Console.WriteLine("Expected : \u00A322.45");
            Console.WriteLine(cart.ToString());

            cart = new Cart();
            cart.AddItem("Cart 2");
            cart.AddItem("FR1");
            cart.AddItem("FR1");
            Console.WriteLine("Expected : \u00A33.11");
            Console.WriteLine(cart.ToString());

            cart = new Cart();
            cart.AddItem("Cart 3");
            cart.AddItem("SR1");
            cart.AddItem("SR1");
            cart.AddItem("FR1");
            cart.AddItem("SR1");
            Console.WriteLine("Expected : \u00A316.61");
            Console.WriteLine(cart.ToString());
        }
Example #3
0
 public void TestMethod3()
 {
     var cart = new Cart();
     cart.AddItem("SR1");
     cart.AddItem("SR1");
     cart.AddItem("FR1");
     cart.AddItem("SR1");
     Assert.AreEqual(cart.GetTotal(), 16.61, 0.001, "Test 3 (SR1, SR1, FR1, SR1) Failed");
 }
Example #4
0
 public void TestMethod1()
 {
     var cart = new Cart();
     cart.AddItem("FR1");
     cart.AddItem("SR1");
     cart.AddItem("FR1");
     cart.AddItem("FR1");
     cart.AddItem("CF1");
     Assert.AreEqual(cart.GetTotal(), 22.45, 0.001, "Test 1 (FR1, SR1, FR1, FR1, CF1) Failed");
 }
Example #5
0
 private static void TestInputString(string input)
 {
     var cart = new Cart();
     var inputList = input.Split(',');
     foreach (var inputItem in inputList.Where(inputItem => cart.AddItem(inputItem) != 0))
     {
         Console.WriteLine("There was an error trying to find the product :" + inputItem);
     }
     Console.Write(cart.ToString());
 }