Example #1
0
        public void GivenItemBackstagePassesHandler_WhenItemIsNotBackstagePasses_ShouldThrowError()
        {
            // Arrange
            var item = new Item()
            {
                Name = "ArbitraryItemX", Quality = 36, SellIn = -3
            };

            // Act
            var actual = new BackstagePassesItemHandler(null);

            // Assert
            Assert.Throws <InvalidOperationException>(() => actual.Handle(item), "Item cannot be handled here");
        }
Example #2
0
        public void GivenItemBackstagePasses_WhenNextDayComes_SellInEquals6_ThenQualityShouldIncreaseByTwo()
        {
            // Arrange
            var item = new Item()
            {
                Name = BackstagePasses, Quality = 25, SellIn = 6
            };

            // Act
            var actual = new BackstagePassesItemHandler(null);

            actual.Handle(item);

            // Assert
            Assert.AreEqual(27, item.Quality);
        }
Example #3
0
        public void GivenItemBackstagePasses_WhenNextDayComes_SellInLessThan10AndHigherThan5_ThenQualityShouldIncreaseByTwo()
        {
            // Arrange
            var item = new Item()
            {
                Name = BackstagePasses, Quality = 13, SellIn = 7
            };

            // Act
            var actual = new BackstagePassesItemHandler(null);

            actual.Handle(item);

            // Assert
            Assert.AreEqual(15, item.Quality);
        }
Example #4
0
        public void GivenItemBackstagePasses_WhenNextDayComes_SellInLessThan0_ThenQualityShouldBe0()
        {
            // Arrange
            var item = new Item()
            {
                Name = BackstagePasses, Quality = 10, SellIn = -2
            };

            // Act
            var actual = new BackstagePassesItemHandler(null);

            actual.Handle(item);

            // Assert
            Assert.AreEqual(0, item.Quality);
        }
Example #5
0
        public void GivenBackstagePassesHandler_WhenNextDayComes_QualityLessThan50_SellInHigherThan0_ThenQualityShouldIncreaseByOne()
        {
            // Arrange
            var item = new Item()
            {
                Name = BackstagePasses, Quality = 49, SellIn = 1
            };

            // Act
            var actual = new BackstagePassesItemHandler(null);

            actual.Handle(item);

            // Assert
            Assert.AreEqual(50, item.Quality);
        }