Beispiel #1
0
 public void TestIncremental()
 {
     CheckOut co = new CheckOut(RULES);
     Assert.AreEqual(0, co.total());
     co.scan("A"); Assert.AreEqual(50.0, co.total());
     co.scan("B"); Assert.AreEqual(80.0, co.total());
     co.scan("A"); Assert.AreEqual(130.0, co.total());
     co.scan("A"); Assert.AreEqual(160.0, co.total());
     co.scan("B"); Assert.AreEqual(175.0, co.total());
 }
Beispiel #2
0
        private Double price(String goods)
        {
            CheckOut co = new CheckOut(RULES);

            for (int i = 0; i < goods.Length; i++)
            {
                co.scan(goods[i].ToString());
            }

            return co.total();
        }