Example #1
0
            public void IsItemAvailable()
            {
                MockFridgeRepository mockRepo     = new MockFridgeRepository();
                FridgeWorker         fridgeWorker = new FridgeWorker(mockRepo);

                Assert.AreEqual(false, fridgeWorker.IsItemAvailable(inventoryItemMeatballs, 7));
            }
Example #2
0
            public void IsExistingItemAvailable()
            {
                MockFridgeRepository mockRepo     = new MockFridgeRepository();
                FridgeWorker         fridgeWorker = new FridgeWorker(mockRepo);

                fridgeWorker.AddIngredientToFridge(new InventoryItem(inventoryItemMeatballs, 10));

                Assert.AreEqual(true, fridgeWorker.IsItemAvailable(inventoryItemMeatballs, 7));
            }
Example #3
0
            public void RemoveInventoryItem()
            {
                MockFridgeRepository mockRepo     = new MockFridgeRepository();
                FridgeWorker         fridgeWorker = new FridgeWorker(mockRepo);
                Double result =
                    fridgeWorker.TakeItemFromFridge(new FridgeInventoryItemContract(inventoryItemMeatballs, 5));

                Assert.AreEqual(-5, result);
            }
Example #4
0
            public void GetItem()
            {
                MockFridgeRepository mockRepo     = new MockFridgeRepository();
                FridgeWorker         fridgeWorker = new FridgeWorker(mockRepo);

                var result = fridgeWorker.GetInventoryItem("Hundgodis");

                Assert.AreEqual(null, result);
            }
Example #5
0
            public void AddOneInventoryItem()
            {
                MockFridgeRepository mockRepo     = new MockFridgeRepository();
                FridgeWorker         fridgeWorker = new FridgeWorker(mockRepo);

                fridgeWorker.AddIngredientToFridge(new InventoryItem(inventoryItemMeatballs, 10));
                Assert.AreEqual(1, mockRepo.InventoryItems.Count);
                Assert.AreEqual(inventoryItemMeatballs, mockRepo.InventoryItems[0].Name);
                Assert.AreEqual(10, mockRepo.InventoryItems[0].Quantity);
            }
Example #6
0
            public void GetExistingInventoryItem()
            {
                MockFridgeRepository mockRepo     = new MockFridgeRepository();
                FridgeWorker         fridgeWorker = new FridgeWorker(mockRepo);

                fridgeWorker.AddIngredientToFridge(new InventoryItem(inventoryItemMeatballs, 10));

                FridgeInventoryItemContract result = fridgeWorker.GetInventoryItem(inventoryItemMeatballs);

                Assert.AreEqual(10, result.Quantity);
            }
Example #7
0
            public void RemoveNonExistingInventoryItem()
            {
                string invItem1      = "Meatballs";
                string invItem2      = "Potato";
                string invItem3      = "Pasta";
                string invRemoveItem = "Sauce";

                MockFridgeRepository mockRepo     = new MockFridgeRepository();
                FridgeWorker         fridgeWorker = new FridgeWorker(mockRepo);

                fridgeWorker.AddIngredientToFridge(new InventoryItem(invItem1, 10));
                fridgeWorker.AddIngredientToFridge(new InventoryItem(invItem2, 50));
                fridgeWorker.AddIngredientToFridge(new InventoryItem(invItem3, 4));

                Double result = fridgeWorker.TakeItemFromFridge(new FridgeInventoryItemContract(invRemoveItem, 5));

                Assert.AreEqual(-5, result);
            }