示例#1
0
        public void sulfurasSellInDoesNotDecreaseAfterADay()
        {
            Sulfuras   item = Sulfuras.Create(sellIn: 5, quality: 20);
            GildedRose app  = new GildedRose(item);

            app.UpdateItemsQualityAfterADay();

            Assert.AreEqual(5, item.SellIn);
        }
示例#2
0
        public void decreaseConjuredQualityTwiceAfterADay()
        {
            Conjured   item = Conjured.Create(name: "Conjured", sellIn: 5, quality: 20);
            GildedRose app  = new GildedRose(item);

            app.UpdateItemsQualityAfterADay();

            Assert.AreEqual(4, item.SellIn);
            Assert.AreEqual(18, item.Quality);
        }
示例#3
0
        public void sulfurasSellInDoesNotDecreaseAfterADay()
        {
            items.Add(new Sulfuras {
                Name = "Sulfuras", SellIn = 5, Quality = 20
            });
            GildedRose app = new GildedRose(items);

            app.UpdateItemsQualityAfterADay();
            Assert.AreEqual(5, items[0].SellIn);
        }
示例#4
0
        public void decrementNormalItemQualityOnceAfterADay()
        {
            EditableItem item = EditableItem.Create("Berger", sellIn: 2, quality: 5);
            GildedRose   app  = new GildedRose(item);

            app.UpdateItemsQualityAfterADay();

            Assert.AreEqual(4, item.Quality);
            Assert.AreEqual(1, item.SellIn);
        }
示例#5
0
        public void decreaseConjuredQualityFourTimesAfterADayWhenExceededSellInDays()
        {
            Conjured   item = Conjured.Create(name: "Conjured", sellIn: 0, quality: 20);
            GildedRose app  = new GildedRose(item);

            app.UpdateItemsQualityAfterADay();

            Assert.AreEqual(-1, item.SellIn);
            Assert.AreEqual(16, item.Quality);
        }
示例#6
0
        public void incrementAgedBrieQualityTwiceAfterADayWhenExceededSellInDays()
        {
            AgedBrie   item = AgedBrie.Create(sellIn: -1, quality: 10);
            GildedRose app  = new GildedRose(item);

            app.UpdateItemsQualityAfterADay();

            Assert.AreEqual(12, item.Quality);
            Assert.AreEqual(-2, item.SellIn);
        }
示例#7
0
        public void incrementConcertPassQualityThriceAfterADayWhenSellInDaysLessThan10()
        {
            ConcertBackstagePass item =
                ConcertBackstagePass.Create(concertName: "Backstage Pass", sellIn: 5, quality: 20);
            GildedRose app = new GildedRose(item);

            app.UpdateItemsQualityAfterADay();

            Assert.AreEqual(23, item.Quality);
            Assert.AreEqual(4, item.SellIn);
        }
示例#8
0
        public void incrementConcertPassQualityThriceAfterADayWhenSellInDaysLessThan10()
        {
            items.Add(new ConcertBackstagePass {
                Name = "Backstage Pass", SellIn = 5, Quality = 20
            });
            GildedRose app = new GildedRose(items);

            app.UpdateItemsQualityAfterADay();
            Assert.AreEqual(23, items[0].Quality);
            Assert.AreEqual(4, items[0].SellIn);
        }
示例#9
0
        public void incrementAgedBrieQualityTwiceAfterADayWhenExceededSellInDays()
        {
            items.Add(new AgedBrie {
                Name = "Aged Brie", SellIn = -1, Quality = 10
            });
            GildedRose app = new GildedRose(items);

            app.UpdateItemsQualityAfterADay();
            Assert.AreEqual(12, items[0].Quality);
            Assert.AreEqual(-2, items[0].SellIn);
        }
示例#10
0
        public void decrementNormalItemQualityOnceAfterADay()
        {
            items.Add(new EditableItem {
                Name = "Berger", SellIn = 2, Quality = 5
            });
            GildedRose app = new GildedRose(items);

            app.UpdateItemsQualityAfterADay();
            Assert.AreEqual(4, items[0].Quality);
            Assert.AreEqual(1, items[0].SellIn);
        }
示例#11
0
        public void decreaseConjuredQualityFourTimesAfterADayWhenExceededSellInDays()
        {
            items.Add(new Conjured {
                Name = "Conjured", SellIn = 0, Quality = 20
            });
            GildedRose app = new GildedRose(items);

            app.UpdateItemsQualityAfterADay();
            Assert.AreEqual(-1, items[0].SellIn);
            Assert.AreEqual(16, items[0].Quality);
        }
示例#12
0
        public void decreaseConjuredQualityTwiceAfterADay()
        {
            items.Add(new Conjured {
                Name = "Conjured", SellIn = 5, Quality = 20
            });
            GildedRose app = new GildedRose(items);

            app.UpdateItemsQualityAfterADay();
            Assert.AreEqual(4, items[0].SellIn);
            Assert.AreEqual(18, items[0].Quality);
        }
示例#13
0
        public void zeroOutConcertPassQualityAfterADayWhenExceededSellInDays()
        {
            ConcertBackstagePass item =
                ConcertBackstagePass.Create(concertName: "Backstage Pass", sellIn: -1, quality: 0);
            GildedRose app = new GildedRose(item);

            app.UpdateItemsQualityAfterADay();

            Assert.AreEqual(0, item.Quality);
            Assert.AreEqual(-2, item.SellIn);
        }
示例#14
0
        public void zeroOutConcertPassQualityAfterADayWhenExceededSellInDays()
        {
            items.Add(new ConcertBackstagePass {
                Name = "Backstage Pass", SellIn = -1, Quality = 0
            });
            GildedRose app = new GildedRose(items);

            app.UpdateItemsQualityAfterADay();
            Assert.AreEqual(0, items[0].Quality);
            Assert.AreEqual(-2, items[0].SellIn);
        }
示例#15
0
        public void itemQualityNeverExceedsMaxWhenIncrementingPerDay()
        {
            EditableItem agedBrie      = AgedBrie.Create(sellIn: 3, quality: MAX_QUANTITY);
            EditableItem backstagePass =
                ConcertBackstagePass.Create(concertName: "TaylorFast", sellIn: 3, quality: MAX_QUANTITY);

            items.Add(agedBrie);
            items.Add(backstagePass);

            GildedRose app = new GildedRose(items);

            app.UpdateItemsQualityAfterADay();

            Assert.AreEqual(MAX_QUANTITY, agedBrie.Quality);
            Assert.AreEqual(MAX_QUANTITY, backstagePass.Quality);
        }
示例#16
0
        public void itemQualityNeverNegative()
        {
            EditableItem item1         = EditableItem.Create("Syomay", sellIn: 5, quality: 0);
            EditableItem backstagePass = ConcertBackstagePass.Create("TaylorFast", sellIn: 0, quality: 0);
            EditableItem conjured      = Conjured.Create("Conjured", sellIn: 0, quality: 2);

            items.Add(item1);
            items.Add(backstagePass);
            items.Add(conjured);

            GildedRose app = new GildedRose(items);

            app.UpdateItemsQualityAfterADay();

            Assert.AreEqual(0, item1.Quality);
            Assert.AreEqual(0, backstagePass.Quality);
            Assert.AreEqual(0, conjured.Quality);
        }
示例#17
0
        public void itemQualityNeverNegative()
        {
            items.Add(new EditableItem {
                Name = "Syomay", SellIn = 5, Quality = 0
            });
            items.Add(new ConcertBackstagePass {
                Name = "TaylorFast", SellIn = 0, Quality = 0
            });
            items.Add(new Conjured {
                Name = "Conjured", SellIn = 0, Quality = 2
            });
            GildedRose app = new GildedRose(items);

            app.UpdateItemsQualityAfterADay();
            Assert.AreEqual(0, items[0].Quality);
            Assert.AreEqual(0, items[1].Quality);
            Assert.AreEqual(0, items[2].Quality);
        }