public void CanAddItemToTill() { var till = new Till(); till.Items.Add(new TillItem(TillItemType.Main(), 1)); Assert.True(till.Items.Count == 1); }
public void CanNotDecrementItemIfQuantityIsOneInTillIs() { var items = new List <TillItem>() { new TillItem(TillItemType.Starter(), 1) }; var till = new Till(items); till.Items.First().DecrementQuantity(); Assert.True(till.Items.First().Quantity == 1); }
public void CanIncrementItemQuantityInTill() { var items = new List <TillItem>() { new TillItem(TillItemType.Starter(), 1) }; var till = new Till(items); till.Items.First().IncrementQuantity(); Assert.True(till.Items.First().Quantity == 2); }
public void GivenTillItemsTheTotalShouldBeCorrect(int mainsQuntity, int startersQuantity, double expectedTotal) { var items = new List <TillItem>() { new TillItem(TillItemType.Main(), mainsQuntity), new TillItem(TillItemType.Starter(), startersQuantity) }; var till = new Till(items); var totalCost = till.TotalCost(); Assert.Equal(expectedTotal, totalCost); }
public void CanDeleteItemFromTill() { var items = new List <TillItem>() { new TillItem(TillItemType.Main(), 1), new TillItem(TillItemType.Starter(), 1) }; var till = new Till(items); till.Items.RemoveAt(1); Assert.True(till.Items.Count == 1); Assert.True(till.Items.Count(i => i.TillItemType.ItemType == ItemType.Starter) == 0); }