Example #1
0
 public void TestTakeDish()
 {
     var customer = new Customer();
     customer.TakeDish(new Dish(PriceRank.A));
     customer.TakeDish(new Dish(PriceRank.B));
     customer.TakeDish(new Dish(PriceRank.B));
     customer.TakeDish(new Dish(PriceRank.C));
     customer.TakeDish(new Dish(PriceRank.A));
     Assert.AreEqual(5, customer.EatenDishes.Count);
 }
Example #2
0
 public void TestSettleUpWithTax()
 {
     var service = new AccountService(new PriceTable(), (price, rank) => (int)(price * 1.05) );
     var customer = new Customer();
     customer.TakeDish( new Dish(PriceRank.A) );
     customer.TakeDish( new Dish(PriceRank.B) );
     customer.TakeDish( new Dish(PriceRank.C) );
     customer.TakeDish( new Dish(PriceRank.C) );
     customer.TakeDish( new Dish(PriceRank.D) );
     Assert.AreEqual(1260, service.SettleUp(customer));
 }
Example #3
0
 public void TestSettleUpDefault()
 {
     var service = new AccountService(new PriceTable());
     var customer = new Customer();
     customer.TakeDish( new Dish(PriceRank.A) );
     customer.TakeDish( new Dish(PriceRank.B) );
     customer.TakeDish( new Dish(PriceRank.C) );
     customer.TakeDish( new Dish(PriceRank.C) );
     customer.TakeDish( new Dish(PriceRank.D) );
     Assert.AreEqual(1200, service.SettleUp(customer));
 }
Example #4
0
 public int SettleUp(Customer customer)
 {
     return customer.EatenDishes.Sum(e => AdditionalPrice(Table.Price(e.Rank), e.Rank) );
 }
Example #5
0
 public void TestConstruct()
 {
     var customer = new Customer();
     Assert.AreEqual(0, customer.EatenDishes.Count);
 }