Example #1
0
        public void UpdateQuality_SellByDateHasNotPassed_ReducesValues()
        {
            // Arrange
            var item = new Item {
                Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20
            };
            var standardRetailItem = new StandardRetailItem(item);

            // Act
            standardRetailItem.UpdateQuality();

            //Assert
            Assert.Equal(9, item.SellIn);
            Assert.Equal(19, item.Quality);
        }
Example #2
0
        public void UpdateQuality_SellByDatePassed_QualityDegradesTwiceAsFast()
        {
            // Arrange
            var item = new Item {
                Name = "+5 Dexterity Vest", SellIn = 0, Quality = 20
            };
            var standardRetailItem = new StandardRetailItem(item);

            // Act
            standardRetailItem.UpdateQuality();

            //Assert
            Assert.Equal(-1, item.SellIn);
            Assert.Equal(18, item.Quality);
        }
        public void UpdateQuality_ItemSellinAboveZero_ReducesQualityTwiceAsFast()
        {
            var item1 = new Item {
                Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20
            };
            var item2 = new Item {
                Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20
            };

            var standardRetailItem = new StandardRetailItem(item1);
            var conjuredRetailItem = new ConjuredRetailItem(item2);

            standardRetailItem.UpdateQuality();
            conjuredRetailItem.UpdateQuality();

            var diff1 = 20 - item1.Quality;
            var diff2 = 20 - item2.Quality;

            var rateComparison = diff2 / diff1;

            Assert.Equal(item1.SellIn, item2.SellIn);
            Assert.Equal(2, rateComparison);
        }