Esempio n. 1
0
        public void Run()
        {
            Print("OMGHAI!");

            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
                },
                // this conjured item does not work properly yet
                new Item {
                    Name = "Conjured Mana Cake", SellIn = 3, Quality = 6
                }
            };

            var app = new GildedRoseStore(new StrategyFactory());


            for (var i = 0; i < 31; i++)
            {
                Print($"-------- day {i} --------");
                Print("name, sellIn, quality");
                for (var j = 0; j < Items.Count; j++)
                {
                    Print($"{Items[j].Name}, {Items[j].SellIn} , {Items[j].Quality}");
                }
                Print("");
                app.UpdateQuality(Items);
            }
        }
Esempio n. 2
0
 private static void DisplayStoreContent(GildedRoseStore store)
 {
     Console.WriteLine();
     Console.WriteLine("The current inventory holds {0} items:", store.Items.Count);
     Console.WriteLine(new String('-', 50));
     foreach (var item in store.Items)
     {
         Console.WriteLine("Of quality {0}\t to be sold before {1}\t {2}", item.Quality, item.SellIn, item.Name);
     }
     Console.WriteLine(new String('-', 50));
 }
Esempio n. 3
0
        static void Main(string[] args)
        {
            var store = new GildedRoseStore();

            while (true)
            {
                DisplayStoreContent(store);
                var readLine = Console.ReadLine();

                if (readLine != null && (readLine.Contains('q') || readLine.Contains('Q')))
                {
                    Console.WriteLine("Thank you for your visit, goodbye.");
                    return;
                }
                else
                {
                    Console.WriteLine();
                    Console.WriteLine("A day has passed, the inventory has changed.");
                    store.UpdateQuality();
                }
            }
        }
 public void Setup()
 {
     _gildedRose = new GildedRoseStore(new StrategyFactory());
 }