Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }