예제 #1
0
        public void foo()
        {
            IList <Item> Items = new List <Item> {
                new Item {
                    Name = "fixme", SellIn = 0, Quality = 0
                }
            };
            IList <GildedRoseItem> gt = new List <GildedRoseItem> {
                ItemFactory.GetItem(Items[0])
            };
            GildedRose app = new GildedRose(gt);

            app.UpdateQuality();
            Assert.AreEqual("fixme", Items[0].Name);
        }
예제 #2
0
        public static void Main(string[] args)
        {
            Console.WriteLine("OMGHAI!");
            List <GildedRoseItem> gildedRoseItems = new List <GildedRoseItem>();
            IList <Item>          Items           = new List <Item> {
                new Item {
                    Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20
                },
                new Item {
                    Name = "Aged Brie", SellIn = 2, Quality = 0
                },
                new Item {
                    Name = "Elixir of the Mongoose", SellIn = 5, Quality = 7
                },
                new Item {
                    Name = "Sulfuras, Hand of Ragnaros", SellIn = 0, Quality = 80
                },
                new Item {
                    Name = "Sulfuras, Hand of Ragnaros", SellIn = -1, Quality = 80
                },
                new Item
                {
                    Name    = "Backstage passes to a TAFKAL80ETC concert",
                    SellIn  = 15,
                    Quality = 20
                },
                new Item
                {
                    Name    = "Backstage passes to a TAFKAL80ETC concert",
                    SellIn  = 10,
                    Quality = 49
                },
                new Item
                {
                    Name    = "Backstage passes to a TAFKAL80ETC concert",
                    SellIn  = 5,
                    Quality = 49
                },
                new Item {
                    Name = "Conjured Mana Cake", SellIn = 3, Quality = 6
                }
            };


            for (var i = 0; i < Items.Count; i++)
            {
                gildedRoseItems.Add(ItemFactory.GetItem(Items[i]));
            }


            var app = new GildedRose(gildedRoseItems);


            for (var i = 0; i < 31; i++)
            {
                Console.WriteLine("-------- day " + i + " --------");
                Console.WriteLine("name, sellIn, quality");
                for (var j = 0; j < Items.Count; j++)
                {
                    System.Console.WriteLine(Items[j]);
                }
                Console.WriteLine("");
                app.UpdateQuality();
            }
        }