public void QualityDegradesDoubleWhenSellInPassed(int quality) { bool sellInPassed = true; int expectedDegradedQuality = quality - (QUALITY_DEGRADES_BY * SELLIN_PASSED_MULTIPLIER); int degradedQuality = InventoryManagementRules.GetDegradedQuality(quality, sellInPassed); Assert.Equal(expectedDegradedQuality, degradedQuality); }
public void QualityDegradesNormallyWhenSellInNotPassed(int quality) { bool sellInPassed = false; int exectedDegradedQuality = quality - QUALITY_DEGRADES_BY; int degradedQuality = InventoryManagementRules.GetDegradedQuality(quality, sellInPassed); Assert.Equal(exectedDegradedQuality, degradedQuality); }
// int.Min rolls over to positive and causes quality to degrade at lower rate (but we aren't manually reducing sellIn in this method, again 6 million years, that's fine) public void QualityDecreases(int sellIn, int quality) { var normalItem = new FinestGood(NORMAL_ITEM_NAME, sellIn, quality); bool sellInPassed = InventoryManagementRules.HasSellInPassed(sellIn); int expectedQuality = InventoryManagementRules.GetDegradedQuality(quality, sellInPassed); new NormalItemUpdaterRuleset().ApplyUpdates(normalItem); Assert.Equal(expectedQuality, normalItem.Quality); }