public void NothingHappens()
            {
                // Method does nothing but serve as explicit confirmation that nothing happens
                InventoryManagementRules.GetSulfurasQuality();

                Assert.True(true); // Check we made it past Sulfuras I guess!
            }
            public void QualityUnchangedBelowMaximum(int quality)
            {
                int expectedQuality = quality;

                int potentiallyUpdatedQuality = InventoryManagementRules.GetMaximumAdjustedQuality(quality);

                Assert.Equal(expectedQuality, potentiallyUpdatedQuality);
            }
            public void IncreasesQuality(int quality)
            {
                int expectedMaturedQuality = quality + QUALITY_MATURES_BY;

                var maturedQuality = InventoryManagementRules.GetMaturedQuality(quality);

                Assert.Equal(expectedMaturedQuality, maturedQuality);
            }
            public void QualityIncreasesBeforeEvent(int quality, int sellIn)
            {
                int expectedQuality = quality + TheGetMaturedQualityMethod.QUALITY_MATURES_BY;

                var updatedQuality = InventoryManagementRules.GetEventQuality(quality, sellIn);

                Assert.Equal(expectedQuality, updatedQuality);
            }
            [InlineData(int.MinValue)] // This rolls over to int.MaxValue. At nearly 6 million years past it's SellIn date it's an edge case we can ignore
            public void ReturnsUpdatedSellIn(int sellIn)
            {
                const int SELLIN_STANDARD_ADJUSTMENT = 1;

                int updatedSellIn = InventoryManagementRules.GetUpdatedSellIn(sellIn);

                Assert.Equal(sellIn - SELLIN_STANDARD_ADJUSTMENT, updatedSellIn);
            }
            public void QualityDegradesNormallyWhenSellInNotPassed(int quality)
            {
                bool sellInPassed = false;

                int exectedDegradedQuality = quality - QUALITY_DEGRADES_BY;

                int degradedQuality = InventoryManagementRules.GetDegradedQuality(quality, sellInPassed);

                Assert.Equal(exectedDegradedQuality, degradedQuality);
            }
            public void ReturnsZeroWhenSellInPassed(int quality, int sellIn)
            {
                const int SELLIN_PASSED_QUALITY = 0;

                int expectedQuality = SELLIN_PASSED_QUALITY;

                int updatedQuality = InventoryManagementRules.GetEventQuality(quality, sellIn);

                Assert.Equal(expectedQuality, updatedQuality);
            }
            public void QualityAdjustedAboveMaximum(int quality)
            {
                const int MAXIMUM_QUALITY = 50;

                int expectedQuality = MAXIMUM_QUALITY;

                int updatedQuality = InventoryManagementRules.GetMaximumAdjustedQuality(quality);

                Assert.Equal(expectedQuality, updatedQuality);
            }
            public void QualityAdjustedBelowMinimum(int quality)
            {
                const int MINIMUM_QUALITY = 0;

                int expectedQuality = MINIMUM_QUALITY;

                int updatedQuality = InventoryManagementRules.GetMinimumAdjustedQuality(quality);

                Assert.Equal(expectedQuality, updatedQuality);
            }
            public void QualityIncreasesMoreWhenEventClose(int quality, int sellIn)
            {
                const int EVENT_CLOSE_QUALITY_INCREASE = 2;

                int expectedQuality = quality + EVENT_CLOSE_QUALITY_INCREASE;

                int updatedQuality = InventoryManagementRules.GetEventQuality(quality, sellIn);

                Assert.Equal(expectedQuality, updatedQuality);
            }
            public void DegradesExtraConjuredRatePastSellIn(int quality)
            {
                bool sellInPassed = true;

                int expectedDegradedQuality = quality - (TheGetDegradedQualityMethod.QUALITY_DEGRADES_BY * TheGetDegradedQualityMethod.SELLIN_PASSED_MULTIPLIER * CONJURED_ADDITIONAL_DEGRADES_MULTIPLIER);

                int degradedQuality = InventoryManagementRules.GetConjuredQuality(quality, sellInPassed);

                Assert.Equal(expectedDegradedQuality, degradedQuality);
            }
            public void DegradesAtConjuredRateDuringSellIn(int quality)
            {
                bool sellInPassed = false;

                int exectedDegradedQuality = quality - (TheGetDegradedQualityMethod.QUALITY_DEGRADES_BY * CONJURED_ADDITIONAL_DEGRADES_MULTIPLIER);

                int degradedQuality = InventoryManagementRules.GetConjuredQuality(quality, sellInPassed);

                Assert.Equal(exectedDegradedQuality, degradedQuality);
            }
            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);
            }
            [InlineData(int.MinValue, -1)] // Min SellIn & Quality Lower Bound
            public void QualityIncreases(int sellIn, int quality)
            {
                var agedBrie = new FinestGood(AGED_BRIE_ITEM_NAME, sellIn, quality);

                int expectedQuality = InventoryManagementRules.GetMaturedQuality(quality);

                new AgedBrieItemUpdaterRuleset().ApplyUpdates(agedBrie);

                Assert.Equal(expectedQuality, agedBrie.Quality);
            }
            public void QualityIncreasesMostWhenEventImminent(int quality, int sellIn)
            {
                const int EVENT_IMMINENT_QUALITY_INCREASE = 3;

                int expectedQuality = quality + EVENT_IMMINENT_QUALITY_INCREASE;

                int updatedQuality = InventoryManagementRules.GetEventQuality(quality, sellIn);

                Assert.Equal(expectedQuality, updatedQuality);
            }
        public void SellInDecreases(string itemName, int sellIn, int quality)
        {
            var finestGood = new FinestGood(itemName, sellIn, quality);

            int expectedSellIn = InventoryManagementRules.GetUpdatedSellIn(sellIn);

            new AgedBrieItemUpdaterRuleset().ApplyUpdates(finestGood);

            Assert.Equal(expectedSellIn, finestGood.SellIn);
        }
        public void AdheresToMinQuality(string itemName, int sellIn, int quality)
        {
            var finestGood = new FinestGood(itemName, sellIn, quality);

            int maturedQuality  = InventoryManagementRules.GetMaturedQuality(quality);
            int expectedQuality = InventoryManagementRules.GetMinimumAdjustedQuality(maturedQuality);

            new AgedBrieItemUpdaterRuleset().ApplyUpdates(finestGood);

            Assert.Equal(expectedQuality, finestGood.Quality);
        }
            // 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 QualityDecreasesIncreasedRate(int sellIn, int quality)
            {
                var conjuredItem = new FinestGood(CONJURED_ITEM_NAME, sellIn, quality);

                bool sellInPassed    = InventoryManagementRules.HasSellInPassed(sellIn);
                int  expectedQuality = InventoryManagementRules.GetConjuredQuality(quality, sellInPassed);

                new ConjuredItemUpdaterRuleset().ApplyUpdates(conjuredItem);

                Assert.Equal(expectedQuality, conjuredItem.Quality);
            }
            // 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);
            }
            public void AppliesEventRule(int sellIn, int quality)
            {
                // We vigorously check the rule conditions in InventoryManagementRules - so here the goal is to make sure it's applied to the ruleset
                var backstagePass = new FinestGood(BACKSTAGE_PASSES_ITEM_NAME, sellIn, quality);

                int expectedQuality = InventoryManagementRules.GetEventQuality(quality, sellIn);

                new BackstagePassesItemUpdaterRuleset().ApplyUpdates(backstagePass);

                Assert.Equal(expectedQuality, backstagePass.Quality);
            }
            public void ReturnsFalseWhenSellInNotPassed(int sellIn)
            {
                bool sellInPassed = InventoryManagementRules.HasSellInPassed(sellIn);

                Assert.False(sellInPassed);
            }