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); }
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)); }
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)); }
public int SettleUp(Customer customer) { return customer.EatenDishes.Sum(e => AdditionalPrice(Table.Price(e.Rank), e.Rank) ); }
public void TestConstruct() { var customer = new Customer(); Assert.AreEqual(0, customer.EatenDishes.Count); }