示例#1
0
        public void Add_Item_To_Existing_Catalogue()
        {
            ICatalogueItem        item1 = new FakeCatalogueItem1();
            ICatalogueItem        item2 = new FakeCatalogueItem1();
            ICatalogueItem        item3 = new FakeCatalogueItem1();
            List <ICatalogueItem> items = new List <ICatalogueItem>()
            {
                item1, item2, item3
            };
            IItem fakeItem1 = new FakeItem();

            item1.Add(fakeItem1);

            IVendingMachineInternal fakeMachine = new FakeVendingMachine();
            ICatalogue catalogue = new SimpleCatalogue();

            catalogue.Init(fakeMachine);
            catalogue.Setup(items);


            IItem fakeItem2 = new FakeItem();

            catalogue.AddItem(fakeItem2);

            Assert.That(catalogue.ContainsItem(fakeItem2).Equals(true));
        }
示例#2
0
        public void Add_A_New_Catalogue_Item()
        {
            IItem item = new FakeItem();
            IVendingMachineInternal fakeMachine = new FakeVendingMachine();
            SimpleCatalogue         catalogue   = new SimpleCatalogue();

            catalogue.Init(fakeMachine);
            catalogue.AddItem(item);
            Console.WriteLine($"Catalogue count = {catalogue.GetCatalogueItems().Count}");
            Assert.That(catalogue.ContainsItem(item).Equals(true));
        }
示例#3
0
        public void Check_Catalogue_For_A_Given_Catalogue()
        {
            ICatalogueItem        item1 = new FakeCatalogueItem1();
            ICatalogueItem        item2 = new FakeCatalogueItem1();
            ICatalogueItem        item3 = new FakeCatalogueItem1();
            List <ICatalogueItem> items = new List <ICatalogueItem>()
            {
                item1, item2, item3
            };

            IVendingMachineInternal fakeMachine = new FakeVendingMachine();
            ICatalogue catalogue = new SimpleCatalogue();

            catalogue.Init(fakeMachine);
            catalogue.Setup(items);

            Assert.That(items.Equals(catalogue.GetCatalogueItems()));
        }