コード例 #1
0
        public void TestProgramSetup()
        {
            var app = new Program();
            var count = app.GetItems().Count;
            var items = new List<Item>();
            var vest = new Item {Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20};

            items.Add(vest);

            // Test the program with the standard constructor
            Assert.True(count == 0, "Intial list is not empty");
            app.AddItems(vest);

            // Test adding an item to the Program
            count = app.GetItems().Count;
            Assert.True(count == 1, "Total items in App should be one. Actual = " + count);

            // Test Program with the list passed via the constructor
            app = new Program(items);
            count = app.GetItems().Count;

            Assert.True(count == 1, "Initial list should have one item");
        }