Пример #1
0
        public void ShouldIncreaseQualityBy3WhenItemNameIsBackstagePassesAndSellInLessThen6()
        {
            var firstItem = new Item { Name = "Backstage passes to a TAFKAL80ETC concert", Quality = 40, SellIn = 5 };
            var items = new[] { firstItem };
            var target = new GildedRose(items);

            target.UpdateQuality();

            Assert.AreEqual(43, firstItem.Quality);
        }
Пример #2
0
        public void ShouldLowerQualityTwiceWhenSellInValueIsLowerThanZero()
        {
            var firstItem = new Item { Name = "Test", Quality = 5, SellIn = -1 };
            var secondItem = new Item { Name = "Test2", Quality = 10, SellIn = 0 };
            var items = new[] { firstItem, secondItem };
            var target = new GildedRose(items);

            target.UpdateQuality();

            Assert.AreEqual(3, firstItem.Quality);
            Assert.AreEqual(8, secondItem.Quality);
        }
Пример #3
0
        public void ShouldIncreaseQualityOnSellInDecreaseWhenItemNameEqualsToAgedBrie()
        {
            var firstItem = new Item { Name = "Aged Brie", Quality = 12, SellIn = 3 };
            var secondItem = new Item { Name = "Aged Brie", Quality = 10, SellIn = 0 };
            var items = new[] { firstItem, secondItem };
            var target = new GildedRose(items);

            target.UpdateQuality();

            Assert.AreEqual(13, firstItem.Quality);
            Assert.AreEqual(12, secondItem.Quality);
        }
Пример #4
0
        public void ShouldLowerSellInValue()
        {
            var firstItem = new Item {Name = "Test", Quality = 5, SellIn = 3};
            var secondItem = new Item {Name = "Test2", Quality = 10, SellIn = 0};
            var items = new[] {firstItem, secondItem};
            var target = new GildedRose(items);

            target.UpdateQuality();

            Assert.AreEqual(2, firstItem.SellIn);
            Assert.AreEqual(-1, secondItem.SellIn);
        }
Пример #5
0
        public void ShouldSetQualityToZeroWhenItemNameIsBackstagePassesAndSellInValueWentLessThan1()
        {
            var firstItem = new Item { Name = "Backstage passes to a TAFKAL80ETC concert", Quality = 40, SellIn = 0 };
            var items = new[] { firstItem };
            var target = new GildedRose(items);

            target.UpdateQuality();

            Assert.AreEqual(0, firstItem.Quality);
        }
Пример #6
0
        public void ShouldNeverIncreaseQualityToMoreThan50()
        {
            var firstItem = new Item { Name = "Aged Brie", Quality = 50, SellIn = 3 };
            var items = new[] { firstItem };
            var target = new GildedRose(items);

            target.UpdateQuality();

            Assert.AreEqual(50, firstItem.Quality);
        }
Пример #7
0
        public void ShouldNeverDropQualityLessThanZero()
        {
            var firstItem = new Item { Name = "Test", Quality = 0, SellIn = 0 };
            var secondItem = new Item { Name = "Test2", Quality = 1, SellIn = 0 };
            var items = new[] { firstItem, secondItem };
            var target = new GildedRose(items);

            target.UpdateQuality();

            Assert.AreEqual(0, firstItem.Quality);
            Assert.AreEqual(0, secondItem.Quality);
        }
Пример #8
0
        public void ShouldNeverChangeSellInOfItemWithNameSulfurus()
        {
            var firstItem = new Item { Name = "Sulfuras, Hand of Ragnaros", Quality = 80, SellIn = 3 };
            var items = new[] { firstItem };
            var target = new GildedRose(items);

            target.UpdateQuality();

            Assert.AreEqual(3, firstItem.SellIn);
        }