예제 #1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("OMGHAI!");

            CompositeItem items = new CompositeItem();

            items.Add(EditableItem.Create(name: "+5 Dexterity Vest", sellIn: 10, quality: 20));
            items.Add(AgedBrie.Create(sellIn: 2, quality: 0));
            items.Add(EditableItem.Create(name: "Elixir of the Mongoose", sellIn: 5, quality: 7));
            items.Add(Sulfuras.Create(sellIn: 0, quality: 80));
            items.Add(Sulfuras.Create(sellIn: -1, quality: 80));
            items.Add(ConcertBackstagePass.Create(concertName: "TAFKAL80ETC", sellIn: 15, quality: 20));
            items.Add(ConcertBackstagePass.Create(concertName: "TAFKAL80ETC", sellIn: 10, quality: 49));
            items.Add(ConcertBackstagePass.Create(concertName: "TAFKAL80ETC", sellIn: 5, quality: 49));
            items.Add(Conjured.Create(name: "Conjured Mana Cake", sellIn: 3, quality: 6));

            GildedRose app = new GildedRose(items);


            for (var i = 0; i < 31; i++)
            {
                Console.WriteLine("-------- day " + i + " --------");
                Console.WriteLine("name, sellIn, quality");

                items.DisplayItems();

                app.UpdateItemsQualityAfterADay();
            }
        }
예제 #2
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);
        }
예제 #3
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);
        }
예제 #4
0
        public void throwErrorWhenItemQualityIsInitiallyGreaterThan50()
        {
            EditableItem item = EditableItem.Create("Item", sellIn: 5, quality: MAX_QUANTITY + 1);

            Assert.Throws <QualityExceededLimitException>(() => new GildedRose(item));
        }