コード例 #1
0
        public void FromEmptyFridgeRemoveInventoryItem()
        {
            FridgeWorker currentFridge = new FridgeWorker();
            Double       result        = currentFridge.TakeItemFromFridge(inventoryItemMeatballs, 5);

            Assert.AreEqual(-5, result);
        }
コード例 #2
0
ファイル: FridgeTester.cs プロジェクト: petsvegit/FridgeAPI
            public void IsItemAvailable()
            {
                MockFridgeRepository mockRepo     = new MockFridgeRepository();
                FridgeWorker         fridgeWorker = new FridgeWorker(mockRepo);

                Assert.AreEqual(false, fridgeWorker.IsItemAvailable(inventoryItemMeatballs, 7));
            }
コード例 #3
0
        public void FromFullFridgeIsItemAvailable()
        {
            FridgeWorker currentFridge = new FridgeWorker();

            currentFridge.AddIngredientToFridge(new FridgeInventory(inventoryItemMeatballs, 10));

            Assert.AreEqual(true, currentFridge.IsItemAvailable(inventoryItemMeatballs, 7));
        }
コード例 #4
0
ファイル: FridgeTester.cs プロジェクト: petsvegit/FridgeAPI
            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));
            }
コード例 #5
0
ファイル: FridgeTester.cs プロジェクト: petsvegit/FridgeAPI
            public void RemoveInventoryItem()
            {
                MockFridgeRepository mockRepo     = new MockFridgeRepository();
                FridgeWorker         fridgeWorker = new FridgeWorker(mockRepo);
                Double result =
                    fridgeWorker.TakeItemFromFridge(new FridgeInventoryItemContract(inventoryItemMeatballs, 5));

                Assert.AreEqual(-5, result);
            }
コード例 #6
0
ファイル: FridgeTester.cs プロジェクト: petsvegit/FridgeAPI
            public void GetItem()
            {
                MockFridgeRepository mockRepo     = new MockFridgeRepository();
                FridgeWorker         fridgeWorker = new FridgeWorker(mockRepo);

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

                Assert.AreEqual(null, result);
            }
コード例 #7
0
        public void DoesInventoryItemExist()
        {
            FridgeWorker currentFridge = new FridgeWorker();

            currentFridge.AddIngredientToFridge(new FridgeInventory(inventoryItemMeatballs, 10));

            FridgeInventory result = currentFridge.GetInventoryItem(inventoryItemMeatballs);

            Assert.AreEqual(10, result.Quantity);
        }
コード例 #8
0
        public void ToEmptyFridgeAddTwoIdenticalInventoryItem()
        {
            FridgeWorker currentFridge = new FridgeWorker();

            currentFridge.AddIngredientToFridge(new FridgeInventory(inventoryItemMeatballs, 10));
            currentFridge.AddIngredientToFridge(new FridgeInventory(inventoryItemMeatballs, 10));

            // Assert.AreEqual( 1, currentFridge.InventoryList.Count);
            // Assert.AreEqual(20, currentFridge.InventoryList[0].Quantity);
        }
コード例 #9
0
ファイル: FridgeTester.cs プロジェクト: petsvegit/FridgeAPI
            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);
            }
コード例 #10
0
ファイル: FridgeTester.cs プロジェクト: petsvegit/FridgeAPI
            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);
            }
コード例 #11
0
        public void FromFullFridgeRemoveNonExistingInventoryItem()
        {
            string       invItem1      = "Meatballs";
            string       invItem2      = "Potato";
            string       invItem3      = "Pasta";
            string       invRemoveItem = "Sauce";
            FridgeWorker currentFridge = new FridgeWorker();

            currentFridge.AddIngredientToFridge(new FridgeInventory(invItem1, 10));
            currentFridge.AddIngredientToFridge(new FridgeInventory(invItem2, 50));
            currentFridge.AddIngredientToFridge(new FridgeInventory(invItem3, 4));

            Double result = currentFridge.TakeItemFromFridge(invRemoveItem, 5);

            Assert.AreEqual(-5, result);
        }
コード例 #12
0
ファイル: FridgeTester.cs プロジェクト: petsvegit/FridgeAPI
            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);
            }
コード例 #13
0
 public FridgeController()
 {
     _fridgeWorker = new FridgeWorker();
 }
コード例 #14
0
        public void FromEmptyFridgeIsItemAvailable()
        {
            FridgeWorker currentFridge = new FridgeWorker();

            Assert.AreEqual(false, currentFridge.IsItemAvailable(inventoryItemMeatballs, 7));
        }
コード例 #15
0
        public void ToEmptyFridgeAddOneInventoryItem()
        {
            FridgeWorker currentFridge = new FridgeWorker();

            currentFridge.AddIngredientToFridge(new FridgeInventory(inventoryItemMeatballs, 10));
        }