示例#1
0
        public void CanAddItemToTill()
        {
            var till = new Till();

            till.Items.Add(new TillItem(TillItemType.Main(), 1));
            Assert.True(till.Items.Count == 1);
        }
示例#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);
        }
示例#3
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);
        }
示例#4
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);
        }
示例#5
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);
        }