Exemple #1
0
        public void QualityShouldNeverBeOver50(int quality)
        {
            // Arrange

            InventoryItem systemUnderTest = new FreshItem(1, quality);

            // Act

            systemUnderTest.MatureOvernight();

            // Assert

            systemUnderTest.Quality.ShouldBe(50);
        }
Exemple #2
0
        public void SellInShouldNotChangeAtMinValue()
        {
            // Arrange

            InventoryItem systemUnderTest = new FreshItem(int.MinValue, 1);

            // Act

            systemUnderTest.MatureOvernight();

            // Assert

            systemUnderTest.SellIn.ShouldBe(int.MinValue);
        }
Exemple #3
0
        public void ShouldDecreaseQualityBy2BeforeSellby(int sellIn, int quality)
        {
            // Arrange

            InventoryItem systemUnderTest = new FreshItem(sellIn, quality);

            // Act

            systemUnderTest.MatureOvernight();

            // Assert

            systemUnderTest.SellIn.ShouldBe(sellIn - 1);
            systemUnderTest.Quality.ShouldBe(quality - 2);
        }
Exemple #4
0
        public void ShouldDecreaseQualityAtDoubleSpeedAtNegative(int positiveSellIn)
        {
            // Arrange

            InventoryItem systemUnderTestPositive = new FreshItem(positiveSellIn, 10);
            InventoryItem systemUnderTestNegative = new FreshItem(-positiveSellIn, 10);

            // Act

            systemUnderTestPositive.MatureOvernight();
            systemUnderTestNegative.MatureOvernight();

            // Assert

            int PositiveDecrease = 10 - systemUnderTestPositive.Quality;
            int NegativeDecrease = 10 - systemUnderTestNegative.Quality;

            NegativeDecrease.ShouldBe(PositiveDecrease * 2);
        }