Esempio n. 1
0
        public void TakeOne_NoItemsLeft_ExceptionThrown()
        {
            Guid waffleGuid = Guid.NewGuid();
            Int32 waffleAmount = 0;

            IEnumerable<ProductCollection> draft = new List<ProductCollection>
            {
                new ProductCollection(new Product(Guid.NewGuid(), "Cupcake", 50), 0),
                new ProductCollection(new Product(Guid.NewGuid(), "Cookie", 10), 3),
                new ProductCollection(new Product(waffleGuid, "Waffle", 30), waffleAmount)
            };

            Menu menu = new Menu(draft);

            menu.TakeOne(waffleGuid);
        }
Esempio n. 2
0
        public void TakeOne_ExistingBarcode_RightItemReturned()
        {
            Guid waffleGuid = Guid.NewGuid();

            IEnumerable<ProductCollection> draft = new List<ProductCollection>
            {
                new ProductCollection(new Product(Guid.NewGuid(), "Cupcake", 50), 4),
                new ProductCollection(new Product(Guid.NewGuid(), "Cookie", 10), 3),
                new ProductCollection(new Product(waffleGuid, "Waffle", 30), 10)
            };

            Menu menu = new Menu(draft);

            Product waffle = menu.TakeOne(waffleGuid);

            Assert.AreEqual(waffle.Barcode, waffleGuid);
        }
Esempio n. 3
0
        public void TakeOne_ExistingBarcode_AmountDecreased()
        {
            Guid waffleGuid = Guid.NewGuid();
            Int32 waffleAmount = 10;

            IEnumerable<ProductCollection> draft = new List<ProductCollection>
            {
                new ProductCollection(new Product(Guid.NewGuid(), "Cupcake", 50), 4),
                new ProductCollection(new Product(Guid.NewGuid(), "Cookie", 10), 3),
                new ProductCollection(new Product(waffleGuid, "Waffle", 30), waffleAmount)
            };

            Menu menu = new Menu(draft);

            Product waffle = menu.TakeOne(waffleGuid);

            Assert.AreEqual(menu.GetAmount(waffleGuid), waffleAmount - 1);
        }
Esempio n. 4
0
        public void TakeOne_NonExistingBarcode_ExceptionThrown()
        {
            IEnumerable<ProductCollection> draft = new List<ProductCollection>
            {
                new ProductCollection(new Product(Guid.NewGuid(), "Cupcake", 50), 4),
                new ProductCollection(new Product(Guid.NewGuid(), "Cookie", 10), 3),
                new ProductCollection(new Product(Guid.NewGuid(), "Waffle", 30), 10)
            };

            Menu menu = new Menu(draft);

            menu.TakeOne(Guid.NewGuid());
        }