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

            var app = new Program()
            {
                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    = "Backstage passes to a TAFKAL80ETC concert",
                        SellIn  = 15,
                        Quality = 20
                    },
                    new Item {
                        Name = "Conjured Mana Cake", SellIn = 3, Quality = 6
                    }
                }
            };


            System.Console.WriteLine("Insert a number of days to count:");

            int daysToCount = 0;

            Int32.TryParse(System.Console.ReadLine(), out daysToCount);

            for (int i = 0; i < daysToCount; i++)
            {
                app.items = app.UpdateQuality(app.items);
                app.items = app.UpdateSellInValues(app.items);
            }

            foreach (var item in app.items)
            {
                System.Console.WriteLine(item.Name + " / " + item.Quality + " / " + item.SellIn);
            }

            System.Console.ReadKey();
        }