コード例 #1
0
        public void ForgettingAnItemNotAlreadyStocked_ThrowsAnException()
        {
            // Arrange
            var sfm      = new SmartFridgeManager();
            var itemType = 123L;

            // Act & Assert
            Assert.Throws <InvalidOperationException>(() => sfm.ForgetItem(itemType));
        }
コード例 #2
0
        public void GetItemsForShoppingListReturnsCorrectItems_WhenAnItemIsForgottenItShouldNotBeReturned()
        {
            // Arrange
            var    sfm             = new SmartFridgeManager();
            var    item1UUID       = "1897";
            var    itemType        = 123L;
            var    itemName        = "Orange Juice";
            double item1FillFactor = 1.0d;

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

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

            // Assert
            Assert.Empty(items);
        }
コード例 #3
0
 public void WhenForgetItemInvokedThenSmartFridgeStopStockingItemIsCalled()
 {
     _smartFridgeManager.ForgetItem(3);
     _smartFridge.Verify(s => s.StopStockingItemType(3));
 }