public void SameItemCannotBeRemovedTwice()
        {
            // Arrange
            var    sfm        = new SmartFridgeManager();
            var    itemUUID   = "8976";
            var    itemType   = 123;
            var    itemName   = "Orange Juice";
            double fillFactor = 1.0d;

            sfm.HandleItemAdded(itemType, itemUUID, itemName, fillFactor);
            sfm.HandleItemRemoved(itemUUID);

            // Act & Assert
            Assert.Throws <InvalidOperationException>(() => sfm.HandleItemRemoved(itemUUID));
        }
        public void AnUnaddedItemCanNotBeRemoved()
        {
            // Arrange
            var sfm      = new SmartFridgeManager();
            var itemUUID = "8976";

            // Act & Assert
            Assert.Throws <InvalidOperationException>(() => sfm.HandleItemRemoved(itemUUID));
        }
        public void AnAddedItemCanBeRemoved()
        {
            // Arrange
            var    sfm        = new SmartFridgeManager();
            var    itemType   = 123;
            var    itemUUID   = "8976";
            var    itemName   = "Orange Juice";
            double fillFactor = 1.0d;

            // Act
            sfm.HandleItemAdded(itemType, itemUUID, itemName, fillFactor);
            sfm.HandleItemRemoved(itemUUID);

            // Assert
            // If we got here without exception that's good enough for this test
        }
        public void GetItemsForShoppingListReturnsCorrectItems_WhenAnItemIsFullyConsumed()
        {
            // Arrange
            var    sfm             = new SmartFridgeManager();
            var    item1UUID       = "18976";
            var    itemType        = 123L;
            var    itemName        = "Orange Juice";
            double item1FillFactor = 0.75d;

            sfm.HandleItemAdded(itemType, item1UUID, itemName, item1FillFactor);
            sfm.HandleItemRemoved(item1UUID);
            double thresholdFillFactor = 0.5;

            object[] expectedResult = new object[] { itemType, 0d };

            // Act
            var items = sfm.GetItems(thresholdFillFactor);

            // Assert
            Assert.Single(items);
            Assert.Contains(expectedResult, items);
        }