Example #1
0
        public void QualityWithSellInPastDate()
        {
            NormalItem item = new NormalItem("testItem", -1, 55, (int)Product.ProductType.NormalItem);

            item.Update();
            Assert.That(item.quality.Equals(50));
        }
Example #2
0
        public void Quality()
        {
            NormalItem item = new NormalItem("testItem", 1, 6, (int)Product.ProductType.NormalItem);

            item.Update();
            Assert.That(item.quality.Equals(5));
        }
Example #3
0
        public void QualityMinLimit()
        {
            NormalItem item = new NormalItem("testItem", 1, -51, (int)Product.ProductType.NormalItem);

            item.Update();
            Assert.That(minQuality <= item.quality && item.quality <= maxQuality);
        }
        public void Test_NormalItem_Update_DegreaseFaster_ReturnOk()
        {
            // Arrange
            NormalItem normalItem = new NormalItem("Teste 1234", 0, 10);

            //Act
            normalItem.Update();

            //Assert
            Assert.Equal(8, normalItem.Quality);
            Assert.Equal(-1, normalItem.SellIn);
        }
        public void Test_NormalItem_Update_MaximumQuality_ReturnOk()
        {
            // Arrange
            NormalItem normalItem = new NormalItem("Teste 1234", 12, 60);

            //Act
            normalItem.Update();

            //Assert
            Assert.Equal(49, normalItem.Quality);
            Assert.Equal(11, normalItem.SellIn);
        }
        public void Normal_Item_Should_Decrease_Quality_By_One(int days)
        {
            // Arrange
            var target = new NormalItem {
                Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20
            };

            //Act
            for (int i = 0; i < days; i++)
            {
                target.Update();
            }

            // Assert
            Assert.Equal("+5 Dexterity Vest", target.Name);
            Assert.Equal(20 - (1 * days), target.Quality);
        }
        public void Normal_Item_Should_Decrease_Quality_By_Two_When_SellingDate_Passed()
        {
            // Arrange
            var days   = 8;
            var target = new NormalItem {
                Name = "+5 Dexterity Vest", SellIn = 5, Quality = 20
            };

            // Act
            for (int i = 0; i < days; i++)
            {
                target.Update();
            }


            // Assert
            Assert.Equal("+5 Dexterity Vest", target.Name);

            //Only passed 8 days but 3 passed selling date, => 20 -5 -(3*2) = 9
            Assert.Equal(9, target.Quality);
        }