示例#1
0
        public void foo()
        {
            //Arrange
            ItemsInit    initItems     = new ItemsInit();
            IList <Item> actualItems   = initItems.Init();
            IList <Item> expectedItems = initItems.Init();

            GildedRose expected = new GildedRose(expectedItems);
            Switch     result   = new Switch(actualItems);

            //Assert all
            //Compare Switch answers with default
            //Note that Conjured Items don't work by default
            //So the Cojured items have been removed from assertion
            for (int i = 0; i < 31; i++)
            {
                for (int j = 0; j < actualItems.Count; j++)
                {
                    if (!expectedItems[j].Name.ToString().StartsWith("Conjured"))
                    {
                        Assert.Equal(expectedItems[j].SellIn, actualItems[j].SellIn);
                        Assert.Equal(expectedItems[j].Quality, actualItems[j].Quality);
                    }
                }
                //Act
                expected.UpdateQuality();
                result.UpdateQuality();
            }
        }
示例#2
0
        public static void Main(string[] args)
        {
            Console.WriteLine("OMGHAI!");
            ItemsInit    initItems = new ItemsInit();
            IList <Item> Items     = initItems.Init();

            //Unit tests
            var test = new GildedRoseTest();

            test.foo();

            // Printing results form Switch and GildedRose
            var app  = new Switch(Items);
            var app1 = new GildedRose(Items);

            //Switch
            System.Console.WriteLine("Printing new Switch");
            printResults(app, Items);
            //GildedRose
            System.Console.WriteLine("Printing default GildedRose");
            printResults(app1, Items);
        }