public VendingMachineStoredContents unload()
    {
        VendingMachineStoredContents contents = new VendingMachineStoredContents();

        // coin rack coins
        CoinRack[] racks = vendingHardware.CoinRacks;
        foreach (CoinRack rack in racks)
        {
            List <Coin> emptiedCoins = rack.Unload();
            contents.CoinsInCoinRacks.Add(emptiedCoins);
        }
        // storage coins
        CoinReceptacle recep      = vendingHardware.StorageBin;
        List <Coin>    recepCoins = recep.Unload();

        foreach (Coin coin in recepCoins)
        {
            contents.PaymentCoinsInStorageBin.Add(coin);
        }
        // pops
        PopCanRack[] popRacks = vendingHardware.PopCanRacks;
        foreach (PopCanRack rack in popRacks)
        {
            List <PopCan> emptiedPops = rack.Unload();
            contents.PopCansInPopCanRacks.Add(emptiedPops);
        }
        return(contents);
    }
Beispiel #2
0
    public VendingMachineStoredContents UnloadVendingMachine(int vmIndex)
    {
        // TODO: Implement

        VendingMachine var = vendingMachines[vmIndex];

        VendingMachineStoredContents temp = new VendingMachineStoredContents();

        foreach (var i in var.CoinRacks)
        {
            temp.CoinsInCoinRacks.Add(i.Unload());
        }
        List <Coin> d = var.StorageBin.Unload();

        foreach (Coin i in d)
        {
            temp.PaymentCoinsInStorageBin.Add(i);
        }

        foreach (var i in var.PopCanRacks)
        {
            temp.PopCansInPopCanRacks.Add(i.Unload());
        }

        return(temp);
    }
Beispiel #3
0
        public void ScrambledCoinKinds()
        {
            coinKinds            = new int[] { 100, 5, 25, 10 };
            selectionButtonCount = 3;
            coinRackCapacity     = 2;
            popCanRackCapacity   = 10;
            receptacleCapacity   = 10;

            List <string> name = new List <string>()
            {
                "Coke", "water", "stuff"
            };
            List <int> cost = new List <int>()
            {
                250, 250, 205
            };

            int[] coinCounts   = new int[] { 0, 1, 2, 1 };
            int[] popCanCounts = new int[] { 1, 1, 1 };

            vm = new VendingMachine(coinKinds, selectionButtonCount, coinRackCapacity, popCanRackCapacity, receptacleCapacity);
            new VendingMachineLogic(vm);

            vm.Configure(name, cost);
            vm.LoadCoins(coinCounts);
            vm.LoadPopCans(popCanCounts);
            vm.SelectionButtons[0].Press();

            var items = vm.DeliveryChute.RemoveItems();

            extraction = new List <IDeliverable>(items);

            Assert.AreEqual(true, CheckDelivery(0, new List <PopCan>()));

            vm.CoinSlot.AddCoin(new Coin(100));
            vm.CoinSlot.AddCoin(new Coin(100));
            vm.CoinSlot.AddCoin(new Coin(100));

            vm.SelectionButtons[0].Press();

            var items1 = vm.DeliveryChute.RemoveItems();

            extraction = new List <IDeliverable>(items1);

            Assert.AreEqual(true, CheckDelivery(50, new List <PopCan>()
            {
                new PopCan("Coke")
            }));

            teardown = UnloadVendingMachine(vm);

            Assert.AreEqual(true, CheckTeardown(215, 100, new List <PopCan>()
            {
                new PopCan("water"), new PopCan("stuff")
            }));
        }
Beispiel #4
0
        // checks if teardown items are correct
        public Boolean checkTeardown(VendingMachineStoredContents storedContents, List <List <Coin> > expectedCoins,
                                     List <List <PopCan> > expectedPops, List <Coin> expectedStorage)
        {
            // loop over each pop rack
            for (int i = 0; i < storedContents.PopCansInPopCanRacks.Count; i++)
            {
                // check length
                if (storedContents.PopCansInPopCanRacks[i].Count != expectedPops[i].Count)
                {
                    return(false);
                }
                // loop over each pop in each rack
                for (int j = 0; j < storedContents.PopCansInPopCanRacks[i].Count; j++)
                {
                    // if any non matches, return false
                    if (!(storedContents.PopCansInPopCanRacks[i][j].Name.Equals(expectedPops[i][j].Name)))
                    {
                        return(false);
                    }
                }
            }

            // loop over each coin rack
            for (int i = 0; i < storedContents.CoinsInCoinRacks.Count; i++)
            {
                // check length
                if (storedContents.CoinsInCoinRacks[i].Count != expectedCoins[i].Count)
                {
                    return(false);
                }
                // loop over each coin in each rack
                for (int j = 0; j < storedContents.CoinsInCoinRacks[i].Count; j++)
                {
                    // if any non matches, return false
                    if (!(storedContents.CoinsInCoinRacks[i][j].Value == expectedCoins[i][j].Value))
                    {
                        return(false);
                    }
                }
            }
            // loop over each coin in storage bin
            for (int i = 0; i < storedContents.PaymentCoinsInStorageBin.Count; i++)
            {
                // if any non matches, return false
                if (!(storedContents.PaymentCoinsInStorageBin[i].Value == expectedStorage[i].Value))
                {
                    return(false);
                }
            }

            // if no fails, return true
            return(true);
        }
Beispiel #5
0
        /*///////////////////////////////
         * // Name    : checkUnload
         * // Purpose : Return a VendingMachineContents containing any items in expected delivery that were not found in actual delivery.
         * //
         * //
         * // Inputs  :
         * //     expected  -- VendingMachineStoredContents representing the expected return from a vending machine unload
         * //     delivered -- VendingMachineStoredContents representing the actual contents returned by a vending machine unload
         * //
         * // Return  :
         * //     remaining -- VendingMachineStoredContents
         * //                  - initially is set equal to expected delivery, items that match in actual delivery are removed one by one
         * //                  - returns an empty list if expected is identical to actual
         * //
         *////////////////////////////////

        public VendingMachineStoredContents checkUnload(VendingMachineStoredContents expected, VendingMachineStoredContents delivered)
        {
            VendingMachineStoredContents remaining    = expected;
            List <List <Coin> >          coinsInRacks = delivered.CoinsInCoinRacks;
            List <List <PopCan> >        popsInRacks  = delivered.PopCansInPopCanRacks;
            List <Coin> coinsInStorage = delivered.PaymentCoinsInStorageBin;

            foreach (var list in coinsInRacks)
            {
                foreach (var item in list)
                {
                    for (int i = 0; i < remaining.CoinsInCoinRacks.Count; i++)
                    {
                        if (containsCoin(remaining.CoinsInCoinRacks[i], item))
                        {
                            remaining.CoinsInCoinRacks[i] = removeCoin(remaining.CoinsInCoinRacks[i], item);
                            break;
                        }
                    }
                }
            }


            foreach (var list in popsInRacks)
            {
                foreach (var item in list)
                {
                    for (int i = 0; i < remaining.PopCansInPopCanRacks.Count; i++)
                    {
                        if (containsPop(remaining.PopCansInPopCanRacks[i], item))
                        {
                            remaining.PopCansInPopCanRacks[i] = removePop(remaining.PopCansInPopCanRacks[i], item);
                            break;
                        }
                    }
                }
            }


            foreach (var item in coinsInStorage)
            {
                if (containsCoin(remaining.PaymentCoinsInStorageBin, item))
                {
                    remaining.PaymentCoinsInStorageBin.Clear();
                    remaining.PaymentCoinsInStorageBin.AddRange(removeCoin(remaining.PaymentCoinsInStorageBin, item));
                }
            }

            return(remaining);
        }
Beispiel #6
0
        public VendingMachineStoredContents UnloadVendingMachine(VendingMachine vm)
        {
            var storedContents = new VendingMachineStoredContents();

            foreach (var coinRack in vm.CoinRacks)
            {
                storedContents.CoinsInCoinRacks.Add(coinRack.Unload());
            }
            storedContents.PaymentCoinsInStorageBin.AddRange(vm.StorageBin.Unload());
            foreach (var popCanRack in vm.PopCanRacks)
            {
                storedContents.PopCansInPopCanRacks.Add(popCanRack.Unload());
            }

            return(storedContents);
        }
Beispiel #7
0
        public void OverloadStorePayment()
        {
            coinKinds            = new int[] { 5, 10, 25, 100 };
            selectionButtonCount = 1;
            coinRackCapacity     = 10;
            popCanRackCapacity   = 10;
            receptacleCapacity   = 10;

            List <string> name = new List <string>()
            {
                "stuff"
            };
            List <int> cost = new List <int>()
            {
                135
            };

            int[] coinCounts   = new int[] { 10, 10, 10, 10 };
            int[] popCanCounts = new int[] { 1 };

            vm = new VendingMachine(coinKinds, selectionButtonCount, coinRackCapacity, popCanRackCapacity, receptacleCapacity);
            new VendingMachineLogic(vm);

            vm.Configure(name, cost);
            vm.LoadCoins(coinCounts);
            vm.LoadPopCans(popCanCounts);

            vm.CoinSlot.AddCoin(new Coin(25));
            vm.CoinSlot.AddCoin(new Coin(100));
            vm.CoinSlot.AddCoin(new Coin(10));
            vm.SelectionButtons[0].Press();

            var items = vm.DeliveryChute.RemoveItems();

            extraction = new List <IDeliverable>(items);

            Assert.AreEqual(true, CheckDelivery(0, new List <PopCan>()
            {
                new PopCan("stuff")
            }));

            teardown = UnloadVendingMachine(vm);

            Assert.AreEqual(true, CheckTeardown(1400, 135, new List <PopCan>()));
        }
Beispiel #8
0
    public VendingMachineStoredContents UnloadVendingMachine(int vmIndex)
    {
        VendingMachineStoredContents contents = new VendingMachineStoredContents();

        foreach (CoinRack cr in this.vendingMachines[vmIndex].CoinRacks)
        {
            contents.CoinsInCoinRacks.Add(cr.Unload());
        }
        foreach (Coin c in this.vendingMachines[vmIndex].StorageBin.Unload())
        {
            contents.PaymentCoinsInStorageBin.Add(c);
        }
        foreach (PopCanRack pcr in this.vendingMachines[vmIndex].PopCanRacks)
        {
            contents.PopCansInPopCanRacks.Add(pcr.Unload());
        }

        return(contents);
    }
Beispiel #9
0
 public void Initialize()
 {
     //VMF = new VendingMachineFactory();
     VMs     = new List <VendingMachine>();
     checker = new Checker();
     //delivered = new List<IDeliverable>();
     expected = new List <IDeliverable>();
     unaccountedForDelivery = new List <IDeliverable>();
     actualUnload           = new VendingMachineStoredContents();
     expectedUnload         = new VendingMachineStoredContents();
     unaccountedForUnload   = new VendingMachineStoredContents();
     five  = new Coin(5);
     ten   = new Coin(10);
     two5  = new Coin(25);
     hund  = new Coin(100);
     coke  = new PopCan("Coke");
     water = new PopCan("water");
     stuff = new PopCan("stuff");
 }
Beispiel #10
0
        public void TeardownWithoutConfigureLoad()
        {
            coinKinds            = new int[] { 5, 10, 25, 100 };
            selectionButtonCount = 3;
            coinRackCapacity     = 10;
            popCanRackCapacity   = 10;
            receptacleCapacity   = 10;

            vm = new VendingMachine(coinKinds, selectionButtonCount, coinRackCapacity, popCanRackCapacity, receptacleCapacity);
            new VendingMachineLogic(vm);

            var items = vm.DeliveryChute.RemoveItems();

            extraction = new List <IDeliverable>(items);

            Assert.AreEqual(true, CheckDelivery(0, new List <PopCan>()));

            teardown = UnloadVendingMachine(vm);

            Assert.AreEqual(true, CheckTeardown(0, 0, new List <PopCan>()));
        }
Beispiel #11
0
        public void CongifureThenConstructFail()
        {
            coinKinds            = new int[] { 5, 10, 25, 100 };
            selectionButtonCount = 3;
            coinRackCapacity     = 10;
            popCanRackCapacity   = 10;
            receptacleCapacity   = 10;

            List <string> name = new List <string>()
            {
                "Coke", "water", "stuff"
            };
            List <int> cost = new List <int>()
            {
                250, 250, 205
            };

            int[] coinCounts   = new int[] { 1, 1, 2, 0 };
            int[] popCanCounts = new int[] { 1, 1, 1 };
            var   pop1         = new PopCan("Coke");
            var   pop2         = new PopCan("water");
            var   pop3         = new PopCan("stuff");

            vm = new VendingMachine(coinKinds, selectionButtonCount, coinRackCapacity, popCanRackCapacity, receptacleCapacity);
            new VendingMachineLogic(null);
            vm.Configure(name, cost);
            vm.LoadCoins(coinCounts);
            vm.LoadPopCans(popCanCounts);

            // var items = vm.DeliveryChute.RemoveItems();
            // extraction = new List<IDeliverable>(items);

            teardown = UnloadVendingMachine(vm);

            CheckTeardown(65, 0, new List <PopCan>()
            {
                pop1, pop2, pop3
            });
            Assert.Fail("Fail!");
        }
    //===========================================================New added
    public VendingMachineStoredContents UnloadVendingMachine(int vmIndex)
    {
        VendingMachineStoredContents unloaded = new VendingMachineStoredContents();

        // Unload every coin rack
        foreach (CoinRack rack in machines[vmIndex].CoinRacks)
        {
            unloaded.CoinsInCoinRacks.Add(rack.Unload());
        }

        // Unload every pop can rack
        foreach (PopCanRack rack in machines[vmIndex].PopCanRacks)
        {
            unloaded.PopCansInPopCanRacks.Add(rack.Unload());
        }

        // Unload storage bin coins
        foreach (Coin coin in machines[vmIndex].StorageBin.Unload())
        {
            unloaded.PaymentCoinsInStorageBin.Add(coin);
        }

        return(unloaded);
    }
Beispiel #13
0
    public VendingMachineStoredContents UnloadVendingMachine(int vmIndex)
    {
        if (vmIndex < 0 || vmIndex >= theVendingMachineFactory.Count)
        {
            throw new Exception("Null vmIndex (UVM).");
        }
        VendingMachine theMachine = theVendingMachineFactory[vmIndex];
        VendingMachineStoredContents theMachineContents = new VendingMachineStoredContents();

        for (int i = 0; i < theMachine.CoinRacks.Length; i++)
        {
            theMachineContents.CoinsInCoinRacks.Add(theMachine.CoinRacks[i].Unload());
        }
        for (int i = 0; i < theMachine.PopCanRacks.Length; i++)
        {
            theMachineContents.PopCansInPopCanRacks.Add(theMachine.PopCanRacks[i].Unload());
        }
        foreach (Coin profit in theMachine.StorageBin.Unload())
        {
            theMachineContents.PaymentCoinsInStorageBin.Add(profit);
        }
        // TODO: Implement
        return(theMachineContents);
    }
        public void Test_CoinRackFull()
        {
            int[] coinKinds = new int[4] {
                5, 10, 25, 100
            };

            int[] costs = new int[1] {
                135
            };
            List <int> popCosts = new List <int>(costs);

            string[] names = new string[1] {
                "stuff"
            };
            List <string> popNames = new List <string>(names);

            int[] coinsToLoad = new int[4] {
                10, 10, 10, 10
            };
            int[] popsToLoad = new int[1] {
                1
            };



            //Mimic Test Script Calls
            var vm = new VendingMachine(coinKinds, 1, 10, 10, 10);

            VMs.Add(vm);
            new VendingMachineLogic(vm);

            VMs[0].Configure(popNames, popCosts);
            VMs[0].LoadCoins(coinsToLoad);
            VMs[0].LoadPopCans(popsToLoad);
            VMs[0].CoinSlot.AddCoin(two5);
            VMs[0].CoinSlot.AddCoin(hund);
            VMs[0].CoinSlot.AddCoin(ten);
            VMs[0].SelectionButtons[0].Press();


            //Get Actual Delivery and set Expected Delivery
            delivered = new List <IDeliverable>(VMs[0].DeliveryChute.RemoveItems());
            expected.Add(stuff);


            //Compare Actual Delivery to Exepected Delivery
            foreach (var item in expected)
            {
                Assert.IsTrue(checker.contains(delivered, item));
                checker.remove(delivered, item);
            }

            Assert.IsTrue(delivered.Count == 0);



            //Get Actual Unload
            var coinRacks = VMs[0].CoinRacks;

            foreach (var item in coinRacks)
            {
                actualUnload.CoinsInCoinRacks.Add(item.Unload());
            }


            var popCanRacks = VMs[0].PopCanRacks;

            foreach (var item in popCanRacks)
            {
                actualUnload.PopCansInPopCanRacks.Add(item.Unload());
            }

            var unload = VMs[0].StorageBin.Unload();

            foreach (var item in unload)
            {
                actualUnload.PaymentCoinsInStorageBin.Add(item);
            }

            //Set Expected Unload
            var expectedCoinList = new List <Coin>()
            {
                five, five, five, five, five, five, five, five, five, five,
                ten, ten, ten, ten, ten, ten, ten, ten, ten, ten,
                two5, two5, two5, two5, two5, two5, two5, two5, two5, two5,
                hund, hund, hund, hund, hund, hund, hund, hund, hund, hund,
            };
            var expectedCoinsInBin = new List <Coin>()
            {
                two5, hund, ten
            };

            expectedUnload.CoinsInCoinRacks.Add(expectedCoinList);
            expectedUnload.PaymentCoinsInStorageBin.AddRange(expectedCoinsInBin);

            //Compare Actual Unload with Expected Unload -- See Function Documentation for "checkUnload" in Checker.cs
            //--------------------------------------------------------------------------------------------------------
            //Remove all items from expected unload that are also in actual unload, return the difference (if any)
            unaccountedForUnload = checker.checkUnload(expectedUnload, actualUnload);

            //Assert that the difference is an empty set
            foreach (var coinList in unaccountedForUnload.CoinsInCoinRacks)
            {
                Assert.IsTrue(coinList.Count == 0);
            }

            foreach (var popList in unaccountedForUnload.PopCansInPopCanRacks)
            {
                Assert.IsTrue(popList.Count == 0);
            }

            Assert.IsTrue(unaccountedForUnload.PaymentCoinsInStorageBin.Count == 0);


            //Reset expected unload
            expectedUnload   = new VendingMachineStoredContents();
            expectedCoinList = new List <Coin>()
            {
                five, five, five, five, five, five, five, five, five, five,
                ten, ten, ten, ten, ten, ten, ten, ten, ten, ten,
                two5, two5, two5, two5, two5, two5, two5, two5, two5, two5,
                hund, hund, hund, hund, hund, hund, hund, hund, hund, hund,
            };
            expectedCoinsInBin = new List <Coin>()
            {
                two5, hund, ten
            };
            expectedUnload.CoinsInCoinRacks.Add(expectedCoinList);
            expectedUnload.PaymentCoinsInStorageBin.AddRange(expectedCoinsInBin);

            //Reverse the inputs to the function call to ensure neither expected nor actual contain different elements from eachother
            //Remove all items from actual unload that are also in expected unload, return the difference (if any)
            unaccountedForUnload = checker.checkUnload(actualUnload, expectedUnload);

            //Assert that the difference is an empty set
            foreach (var coinList in unaccountedForUnload.CoinsInCoinRacks)
            {
                Assert.IsTrue(coinList.Count == 0);
            }

            foreach (var popList in unaccountedForUnload.PopCansInPopCanRacks)
            {
                Assert.IsTrue(popList.Count == 0);
            }

            Assert.IsTrue(unaccountedForUnload.PaymentCoinsInStorageBin.Count == 0);
        }
Beispiel #15
0
        public void U02badCostsList()
        {
            // set up create values
            int[] coinKindArray        = { 5, 10, 25, 100 };
            int   selectionButtonCount = 3;
            int   coinRackCapacity     = 10;
            int   popRackCapcity       = 10;
            int   receptacleCapacity   = 10;
            // create vending machine, and vending machine logic using
            // these values
            var vm = new VendingMachine(coinKindArray, selectionButtonCount, coinRackCapacity, popRackCapcity, receptacleCapacity);

            new VendingMachineLogic(vm);
            // configure machine
            List <string> popNames = new List <string> {
                "Coke", "water", "stuff"
            };

            List <int> popCosts = new List <int> {
                250, 250, 0
            };

            vm.Configure(popNames, popCosts);
            // load coins
            helper.loadCoins(5, 1, 0, vm);
            helper.loadCoins(10, 1, 1, vm);
            helper.loadCoins(25, 2, 2, vm);
            helper.loadCoins(100, 0, 3, vm);

            // load pops
            helper.loadPops("Coke", 1, 0, vm);
            helper.loadPops("water", 1, 1, vm);
            helper.loadPops("stuff", 1, 2, vm);

            //===============
            // Check Teardown
            //===============
            // check if teardown correct
            // get the teardown items
            var storedContents = new VendingMachineStoredContents();

            foreach (var coinRack in vm.CoinRacks)
            {
                storedContents.CoinsInCoinRacks.Add(coinRack.Unload());
            }
            storedContents.PaymentCoinsInStorageBin.AddRange(vm.StorageBin.Unload());
            foreach (var popCanRack in vm.PopCanRacks)
            {
                storedContents.PopCansInPopCanRacks.Add(popCanRack.Unload());
            }

            // create expected lists
            var expectedStorageBin = new List <Coin>();
            var expectedCoins      = new List <List <Coin> > {
                new List <Coin>(),
                new List <Coin>(),
                new List <Coin>(),
                new List <Coin>()
            };
            var expectedPops = new List <List <PopCan> > {
                new List <PopCan>(),
                new List <PopCan>(),
                new List <PopCan>()
            };

            Boolean success = helper.checkTeardown(storedContents, expectedCoins, expectedPops, expectedStorageBin);

            Assert.AreEqual(success, true);
        }
Beispiel #16
0
        public void ComplexExtractionBeforeSale()
        {
            coinKinds            = new int[] { 100, 5, 25, 10 };
            selectionButtonCount = 3;
            coinRackCapacity     = 10;
            popCanRackCapacity   = 10;
            receptacleCapacity   = 10;

            List <string> name = new List <string>()
            {
                "Coke", "water", "stuff"
            };
            List <int> cost = new List <int>()
            {
                250, 250, 205
            };

            int[] coinCounts   = new int[] { 0, 1, 2, 1 };
            int[] popCanCounts = new int[] { 1, 1, 1 };

            vm = new VendingMachine(coinKinds, selectionButtonCount, coinRackCapacity, popCanRackCapacity, receptacleCapacity);
            new VendingMachineLogic(vm);

            vm.Configure(name, cost);
            vm.LoadCoins(coinCounts);
            vm.LoadPopCans(popCanCounts);
            vm.SelectionButtons[0].Press();

            var items1 = vm.DeliveryChute.RemoveItems();

            extraction = new List <IDeliverable>(items1);

            Assert.AreEqual(true, CheckDelivery(0, new List <PopCan>()));

            vm.CoinSlot.AddCoin(new Coin(100));
            vm.CoinSlot.AddCoin(new Coin(100));
            vm.CoinSlot.AddCoin(new Coin(100));

            var items2 = vm.DeliveryChute.RemoveItems();

            extraction = new List <IDeliverable>(items2);

            Assert.AreEqual(true, CheckDelivery(0, new List <PopCan>()));

            teardown = UnloadVendingMachine(vm);

            Assert.AreEqual(true, CheckTeardown(65, 0, new List <PopCan>()
            {
                new PopCan("Coke"), new PopCan("water"), new PopCan("stuff")
            }));

            vm.LoadCoins(coinCounts);
            vm.LoadPopCans(popCanCounts);
            vm.SelectionButtons[0].Press();

            var items3 = vm.DeliveryChute.RemoveItems();

            extraction = new List <IDeliverable>(items3);

            Assert.AreEqual(true, CheckDelivery(50, new List <PopCan>()
            {
                new PopCan("Coke")
            }));

            teardown = UnloadVendingMachine(vm);

            Assert.AreEqual(true, CheckTeardown(315, 0, new List <PopCan>()
            {
                new PopCan("water"), new PopCan("stuff")
            }));

            List <string> name1 = new List <string>()
            {
                "A", "B", "C"
            };
            List <int> cost1 = new List <int>()
            {
                5, 10, 25
            };

            VendingMachine vm1 = new VendingMachine(coinKinds, selectionButtonCount, coinRackCapacity, popCanRackCapacity, receptacleCapacity);

            new VendingMachineLogic(vm1);
            vm1.Configure(name, cost);
            vm1.Configure(name1, cost1);

            teardown = UnloadVendingMachine(vm1);

            Assert.AreEqual(true, CheckTeardown(0, 0, new List <PopCan>()));

            vm1.LoadCoins(coinCounts);
            vm1.LoadPopCans(popCanCounts);

            vm1.CoinSlot.AddCoin(new Coin(10));
            vm1.CoinSlot.AddCoin(new Coin(5));
            vm1.CoinSlot.AddCoin(new Coin(10));

            vm1.SelectionButtons[2].Press();

            var items4 = vm1.DeliveryChute.RemoveItems();

            extraction = new List <IDeliverable>(items4);

            Assert.AreEqual(true, CheckDelivery(0, new List <PopCan>()
            {
                new PopCan("C")
            }));

            teardown = UnloadVendingMachine(vm1);

            Assert.AreEqual(true, CheckTeardown(90, 0, new List <PopCan>()
            {
                new PopCan("A"), new PopCan("B")
            }));
        }
Beispiel #17
0
        public void U01badConfigureBeforeSaleCompletion()
        {
            VendingMachine vm = null;

            new VendingMachineLogic(vm);
            // configure machine
            List <string> popNames = new List <string> {
                "Coke", "water", "stuff"
            };

            List <int> popCosts = new List <int> {
                250, 250, 205
            };

            vm.Configure(popNames, popCosts);
            // load coins
            helper.loadCoins(5, 1, 0, vm);
            helper.loadCoins(10, 1, 1, vm);
            helper.loadCoins(25, 2, 2, vm);
            helper.loadCoins(100, 0, 3, vm);

            // load pops
            helper.loadPops("Coke", 1, 0, vm);
            helper.loadPops("water", 1, 1, vm);
            helper.loadPops("stuff", 1, 2, vm);

            //===============
            // Check Teardown
            //===============
            // check if teardown correct
            // get the teardown items
            var storedContents = new VendingMachineStoredContents();

            foreach (var coinRack in vm.CoinRacks)
            {
                storedContents.CoinsInCoinRacks.Add(coinRack.Unload());
            }
            storedContents.PaymentCoinsInStorageBin.AddRange(vm.StorageBin.Unload());
            foreach (var popCanRack in vm.PopCanRacks)
            {
                storedContents.PopCansInPopCanRacks.Add(popCanRack.Unload());
            }

            // create expected lists
            var expectedStorageBin = new List <Coin>();
            var expectedCoins      = new List <List <Coin> > {
                new List <Coin> {
                    new Coin(5)
                },
                new List <Coin> {
                    new Coin(10)
                },
                new List <Coin> {
                    new Coin(25), new Coin(25)
                },
                new List <Coin>()
            };
            var expectedPops = new List <List <PopCan> > {
                new List <PopCan> {
                    new PopCan("Coke")
                },
                new List <PopCan> {
                    new PopCan("water")
                },
                new List <PopCan> {
                    new PopCan("stuff")
                }
            };

            Boolean success = helper.checkTeardown(storedContents, expectedCoins, expectedPops, expectedStorageBin);

            Assert.AreEqual(success, true);
        }
Beispiel #18
0
        public void B03invalidCapacity()
        {
            // set up create values
            int[] coinKindArray        = { 5, 10, 25, 100 };
            int   selectionButtonCount = 3;
            int   coinRackCapacity     = 1;
            int   popRackCapcity       = 10;
            int   receptacleCapacity   = 10;
            // create vending machine, and vending machine logic using
            // these values
            var vm = new VendingMachine(coinKindArray, selectionButtonCount, coinRackCapacity, popRackCapcity, receptacleCapacity);

            new VendingMachineLogic(vm);
            // configure machine
            List <string> popNames = new List <string> {
                "Diet", "water", "stuff"
            };
            List <int> popCosts = new List <int> {
                5, 250, 205
            };

            vm.Configure(popNames, popCosts);
            // load coins
            helper.loadCoins(5, 1, 0, vm);

            // load pops
            helper.loadPops("Diet", 1, 0, vm);
            helper.loadPops("water", 1, 1, vm);
            helper.loadPops("stuff", 1, 2, vm);

            // insert coins
            helper.insertCoins(new int[] { 5, 5, 5 }, vm);
            // press button
            int value = 0;

            vm.SelectionButtons[value].Press();
            // extract
            var items     = vm.DeliveryChute.RemoveItems();
            var itemsList = new List <IDeliverable>(items);

            //===============
            // Check Delivery
            //===============
            // now check items
            int expectedItems = 2;

            if (itemsList.Count != expectedItems)
            {
                Assert.Fail("Different number of items: " + itemsList.Count);
            }

            List <IDeliverable> expectedList = new List <IDeliverable> {
                new PopCan("Diet"), new Coin(5)
            };
            // check if delivery correct
            Boolean success = helper.checkDelivery(expectedList, itemsList);

            Assert.AreEqual(success, true);

            //===============
            // Check Teardown
            //===============
            // check if teardown correct
            // get the teardown items
            var storedContents = new VendingMachineStoredContents();

            foreach (var coinRack in vm.CoinRacks)
            {
                storedContents.CoinsInCoinRacks.Add(coinRack.Unload());
            }
            storedContents.PaymentCoinsInStorageBin.AddRange(vm.StorageBin.Unload());
            foreach (var popCanRack in vm.PopCanRacks)
            {
                storedContents.PopCansInPopCanRacks.Add(popCanRack.Unload());
            }

            // create expected lists
            var expectedStorageBin = new List <Coin>
            {
                new Coin(5), new Coin(5), new Coin(5)
            };
            var expectedCoins = new List <List <Coin> > {
                new List <Coin>(),
                new List <Coin>(),
                new List <Coin>(),
                new List <Coin>()
            };
            var expectedPops = new List <List <PopCan> > {
                new List <PopCan>(),
                new List <PopCan> {
                    new PopCan("water")
                },
                new List <PopCan> {
                    new PopCan("stuff")
                }
            };

            success = helper.checkTeardown(storedContents, expectedCoins, expectedPops, expectedStorageBin);
            Assert.AreEqual(success, true);
        }
 private void announceUnload(int vmIndex)
 {
     this.teardown = vm.UnloadVendingMachine(vmIndex);
 }
 public void RegisterVendingMachineFactory(IVendingMachineFactory vm)
 {
     this.vm         = vm;
     this.extraction = new List <IDeliverable>();
     this.teardown   = new VendingMachineStoredContents();
 }
        public void T13_good_need_to_store_payment()
        {
            List <VendingMachine> vendingMachines = new List <VendingMachine>();          // Create list of VMs.

            //==========================================================================================================
            //  CREATE(5, 10, 25, 100; 3; 10; 10; 10):
            int[] coinKinds            = { 5, 10, 25, 100 };
            int   selectionButtonCount = 1;
            int   coinRackCapacity     = 10;
            int   popRackCapcity       = 10;
            int   receptacleCapacity   = 10;
            // Create VM:
            var vm = new VendingMachine(coinKinds, selectionButtonCount, coinRackCapacity, popRackCapcity, receptacleCapacity);
            VendingMachineLogic vmLogic = new VendingMachineLogic(vm);

            //Add it to the list of VM's:
            vendingMachines.Add(vm);

            int index = 0;                                                              // Index of VM which is going to be checked.

            vm = vendingMachines[index];                                                // Reference to the vending machine at index 0.

            //==================================================================================================================
            //  CONFIGURE([0] "stuff", 135):
            List <string> popNames = new List <string>()
            {
                "stuff"
            };
            List <int> popCosts = new List <int>()
            {
                135
            };

            vm.Configure(popNames, popCosts);

            //===================================================================================================================
            //  COIN_LOAD([0] 0; 5, 10):
            int         coinKindIndex = 0;
            List <Coin> coins         = new List <Coin> {
                new Coin(5), new Coin(5), new Coin(5), new Coin(5), new Coin(5),
                new Coin(5), new Coin(5), new Coin(5), new Coin(5), new Coin(5)
            };

            vm.CoinRacks[coinKindIndex].LoadCoins(coins);

            // COIN_LOAD([0] 1; 10, 10):
            coinKindIndex = 1;
            coins         = new List <Coin> {
                new Coin(10), new Coin(10), new Coin(10), new Coin(10), new Coin(10),
                new Coin(10), new Coin(10), new Coin(10), new Coin(10), new Coin(10)
            };
            vm.CoinRacks[coinKindIndex].LoadCoins(coins);

            //  COIN_LOAD([0] 2; 25, 10):
            coinKindIndex = 2;
            coins         = new List <Coin> {
                new Coin(25), new Coin(25), new Coin(25), new Coin(25), new Coin(25),
                new Coin(25), new Coin(25), new Coin(25), new Coin(25), new Coin(25)
            };
            vm.CoinRacks[coinKindIndex].LoadCoins(coins);

            //  COIN_LOAD([0] 3; 100, 10):
            coinKindIndex = 3;
            coins         = new List <Coin> {
                new Coin(100), new Coin(100), new Coin(100), new Coin(100), new Coin(100),
                new Coin(100), new Coin(100), new Coin(100), new Coin(100), new Coin(100)
            };
            vm.CoinRacks[coinKindIndex].LoadCoins(coins);


            //=====================================================================================================================
            //  POP_LOAD([0] 0; "stuff", 1):
            int           popKindIndex = 0;
            List <PopCan> pops         = new List <PopCan> {
                new PopCan("stuff")
            };

            vm.PopCanRacks[popKindIndex].LoadPops(pops);

            //=======================================================================================================================
            //  INSERT([0] 25)
            //  INSERT([0] 100)
            //  INSERT([0] 10)
            vm.CoinSlot.AddCoin(new Coin(25));
            vm.CoinSlot.AddCoin(new Coin(100));
            vm.CoinSlot.AddCoin(new Coin(10));

            //======================================================================================================================
            //  PRESS([0] 0):
            vm.SelectionButtons[0].Press();

            //=====================================================================================================================
            //  EXTRACT([0])
            //  CHECK_DELIVERY(0, "stuff"):
            // Get actual list of items from the delivery chute and create expected list of items:
            var items = vm.DeliveryChute.RemoveItems();
            List <IDeliverable> itemsAsList         = new List <IDeliverable>(items);
            List <IDeliverable> expectedItemsAsList = new List <IDeliverable> {
                new PopCan("stuff")
            };

            // Check to see if two lists are of the same length, if not, throw the exception:
            if (itemsAsList.Count == expectedItemsAsList.Count)
            {
                int i = 0;
                while (i < items.Length)
                {
                    // Compare element by element:
                    var element1 = items[i];
                    var element2 = expectedItemsAsList[i];
                    Assert.AreEqual(element1.ToString(), element2.ToString());
                    i++;
                }
            }
            // Lists have different length, they are not the same, throw the exception:
            else
            {
                throw new AssertFailedException();
            }

            //=====================================================================================================================
            //  UNLOAD([0])
            //  CHECK_TEARDOWN(1400; 135):
            //  Modify fields of the StoredContents obj, which corresponds to actual VM:
            var storedContents = new VendingMachineStoredContents();

            foreach (var coinRack in vm.CoinRacks)
            {
                // Add items to CoinInCoinsRacks field:
                storedContents.CoinsInCoinRacks.Add(coinRack.Unload());
            }

            // Modify PaymentCoinsInStorageBin field (add some items to it):
            storedContents.PaymentCoinsInStorageBin.AddRange(vm.StorageBin.Unload());

            foreach (var popCanRack in vm.PopCanRacks)
            {
                // Add items to PopCansInPopCanRacks field:
                storedContents.PopCansInPopCanRacks.Add(popCanRack.Unload());
            }

            // Modify fields of the StoredContents obj, based on expected values:
            VendingMachineStoredContents expectedStoredContents = new VendingMachineStoredContents();

            // Modify PaymentCoinsInStorageBin field of the expected one:
            List <Coin> expectedCoinsInStorageBin = new List <Coin> {
                new Coin(25), new Coin(100), new Coin(10)
            };

            foreach (var coin in expectedCoinsInStorageBin)
            {
                expectedStoredContents.PaymentCoinsInStorageBin.Add(coin);
            }

            // Create some lists in order to add them to CoinsInCoinRacks of the expected one:
            List <Coin> expectedCoinRack0 = new List <Coin> {
                new Coin(5), new Coin(5), new Coin(5), new Coin(5), new Coin(5),
                new Coin(5), new Coin(5), new Coin(5), new Coin(5), new Coin(5)
            };
            List <Coin> expectedCoinRack1 = new List <Coin> {
                new Coin(10), new Coin(10), new Coin(10), new Coin(10), new Coin(10),
                new Coin(10), new Coin(10), new Coin(10), new Coin(10), new Coin(10)
            };
            List <Coin> expectedCoinRack2 = new List <Coin> {
                new Coin(25), new Coin(25), new Coin(25), new Coin(25), new Coin(25),
                new Coin(25), new Coin(25), new Coin(25), new Coin(25), new Coin(25)
            };
            List <Coin> expectedCoinRack3 = new List <Coin> {
                new Coin(100), new Coin(100), new Coin(100), new Coin(100), new Coin(100),
                new Coin(100), new Coin(100), new Coin(100), new Coin(100), new Coin(100)
            };
            List <List <Coin> > expectedListOfCoinRacks = new List <List <Coin> > {
                expectedCoinRack0, expectedCoinRack1, expectedCoinRack2, expectedCoinRack3
            };

            foreach (var list in expectedListOfCoinRacks)
            {
                //  Modify CoinsInCoinRacks field by adding some items to it:
                expectedStoredContents.CoinsInCoinRacks.Add(list);
            }

            // Create some lists in order to add them to PopCansInPopCanRacks of the expected one:
            List <PopCan> expectedPopRack0 = new List <PopCan> {
            };
            List <List <PopCan> > expectedListOfPopRacks = new List <List <PopCan> > {
                expectedPopRack0
            };

            foreach (var list in expectedListOfPopRacks)
            {
                //  Modify PopCansInPopCanRacks field by adding some items to it:
                expectedStoredContents.PopCansInPopCanRacks.Add(list);
            }

            // Comparison of expected and actual VM's storage bins:
            // Check length of lists first, if different, throw the exception:
            if (storedContents.PaymentCoinsInStorageBin.Count == expectedStoredContents.PaymentCoinsInStorageBin.Count)
            {
                int i = 0;

                // Check each element of the list:
                while (i < storedContents.PaymentCoinsInStorageBin.Count)
                {
                    Assert.AreEqual(storedContents.PaymentCoinsInStorageBin[i].Value, expectedStoredContents.PaymentCoinsInStorageBin[i].Value);
                    i++;
                }
            }
            // Length is different, throw the exception:
            else
            {
                throw new AssertFailedException();
            }

            // Comparison of expected and actual VM's storage coin racks:
            // Check length of lists first, if different, throw the exception:
            if (storedContents.CoinsInCoinRacks.Count == expectedStoredContents.CoinsInCoinRacks.Count)
            {
                int i = 0;
                int j = 0;
                // Length is the same, check the inner lists:
                while (i < storedContents.CoinsInCoinRacks.Count)
                {
                    // Check the length of the innner lists, throw exception if different:
                    if (storedContents.CoinsInCoinRacks[i].Count == expectedStoredContents.CoinsInCoinRacks[i].Count)
                    {
                        // Compare the values of each elements in the inner lists:
                        while (j < storedContents.CoinsInCoinRacks[i].Count)
                        {
                            Assert.AreEqual(storedContents.CoinsInCoinRacks[i][j].Value, expectedStoredContents.CoinsInCoinRacks[i][j].Value);
                            j++;
                        }
                    }
                    // Length is different of the inner lists, throw the exception:
                    else
                    {
                        throw new AssertFailedException();
                    }
                    // Go to the next pair of inner lists:
                    j = 0;
                    i++;
                }
            }
            // Length of the outer lists is different, throw the exception:
            else
            {
                throw new AssertFailedException();
            }

            // Check to see if length of PopCansInPopCanRacks lists is the same:
            if (storedContents.PopCansInPopCanRacks.Count == expectedStoredContents.PopCansInPopCanRacks.Count)
            {
                int i = 0;
                int j = 0;
                // Length of outer lists is the same, check the inner lists:
                while (i < storedContents.PopCansInPopCanRacks.Count)
                {
                    // Make sure that the length of the inner lists is the same:
                    if (storedContents.PopCansInPopCanRacks[i].Count == expectedStoredContents.PopCansInPopCanRacks[i].Count)
                    {
                        // Length of the inner lists is the same, compare the name of all elements in the inner lists:
                        while (j < storedContents.PopCansInPopCanRacks[i].Count)
                        {
                            Assert.AreEqual(storedContents.PopCansInPopCanRacks[i][j].Name, expectedStoredContents.PopCansInPopCanRacks[i][j].Name);
                            j++;
                        }
                    }
                    // Length of the inner lists is different, throw the exception:
                    else
                    {
                        throw new AssertFailedException();
                    }
                    j = 0;
                    i++;
                }
            }
            // Length of the outer lists is different, throw the exception:
            else
            {
                throw new AssertFailedException();
            }
        }
        public void Test_ChangingConfiguration()
        {
            int[] coinKinds = new int[4] {
                5, 10, 25, 100
            };

            int[] costs = new int[3] {
                5, 10, 25
            };
            List <int> popCosts = new List <int>(costs);

            string[] names = new string[3] {
                "A", "B", "C"
            };
            List <string> popNames = new List <string>(names);

            int[] coinsToLoad = new int[4] {
                1, 1, 2, 0
            };
            int[] popsToLoad = new int[3] {
                1, 1, 1,
            };


            //Mimic Test Script Calls
            var vm = new VendingMachine(coinKinds, 3, 10, 10, 10);

            VMs.Add(vm);
            new VendingMachineLogic(vm);

            VMs[0].Configure(popNames, popCosts);
            VMs[0].LoadCoins(coinsToLoad);
            VMs[0].LoadPopCans(popsToLoad);

            names = new string[3] {
                "Coke", "water", "stuff"
            };
            popNames = new List <string>(names);
            costs    = new int[3] {
                250, 250, 205
            };
            popCosts = new List <int> (costs);

            VMs[0].Configure(popNames, popCosts);

            VMs[0].SelectionButtons[0].Press();


            //Get Actual Delivery and set Expected Delivery
            delivered = new List <IDeliverable>(VMs[0].DeliveryChute.RemoveItems());

            //Compare Actual Delivery to Exepected Delivery
            foreach (var item in expected)
            {
                Assert.IsTrue(delivered.Contains(item));
                delivered.Remove(item);
            }

            Assert.IsTrue(delivered.Count == 0);


            //Mimic Continuation of Test Script
            VMs[0].CoinSlot.AddCoin(new Coin(100));
            VMs[0].CoinSlot.AddCoin(new Coin(100));
            VMs[0].CoinSlot.AddCoin(new Coin(100));
            VMs[0].SelectionButtons[0].Press();



            //Get Actual Delivery and set Expected Delivery
            delivered = new List <IDeliverable>(VMs[0].DeliveryChute.RemoveItems());
            expected.Add(two5);
            expected.Add(two5);
            expected.Add(A);


            //Compare Actual Delivery to Exepected Delivery
            foreach (var item in expected)
            {
                Assert.IsTrue(checker.contains(delivered, item));
                checker.remove(delivered, item);
            }

            Assert.IsTrue(delivered.Count == 0);


            //Get Actual Unload
            var coinRacks = VMs[0].CoinRacks;

            foreach (var item in coinRacks)
            {
                actualUnload.CoinsInCoinRacks.Add(item.Unload());
            }

            var popCanRacks = VMs[0].PopCanRacks;

            foreach (var item in popCanRacks)
            {
                actualUnload.PopCansInPopCanRacks.Add(item.Unload());
            }

            var unload = VMs[0].StorageBin.Unload();

            foreach (var item in unload)
            {
                actualUnload.PaymentCoinsInStorageBin.Add(item);
            }


            //Set Expected Unload
            var expectedCoinList = new List <Coin>()
            {
                five, ten, hund, hund, hund
            };
            var expectedPopList = new List <PopCan>()
            {
                B, C
            };

            expectedUnload.CoinsInCoinRacks.Add(expectedCoinList);
            expectedUnload.PopCansInPopCanRacks.Add(expectedPopList);


            //Compare Actual Unload with Expected Unload -- See Function Documentation for "checkUnload" in Checker.cs
            //--------------------------------------------------------------------------------------------------------
            //Remove all items from expected unload that are also in actual unload, return the difference (if any)
            unaccountedForUnload = checker.checkUnload(expectedUnload, actualUnload);

            //Assert that the difference is an empty set
            foreach (var coinList in unaccountedForUnload.CoinsInCoinRacks)
            {
                Assert.IsTrue(coinList.Count == 0);
            }

            foreach (var popList in unaccountedForUnload.PopCansInPopCanRacks)
            {
                Assert.IsTrue(popList.Count == 0);
            }

            Assert.IsTrue(unaccountedForUnload.PaymentCoinsInStorageBin.Count == 0);


            //Reset expected unload
            expectedUnload   = new VendingMachineStoredContents();
            expectedCoinList = new List <Coin>()
            {
                five, ten, hund, hund, hund
            };
            expectedPopList = new List <PopCan>()
            {
                B, C
            };
            expectedUnload.CoinsInCoinRacks.Add(expectedCoinList);
            expectedUnload.PopCansInPopCanRacks.Add(expectedPopList);

            //Reverse the inputs to the function call to ensure neither expected nor actual contain different elements from eachother
            //Remove all items from actual unload that are also in expected unload, return the difference (if any)
            unaccountedForUnload = checker.checkUnload(actualUnload, expectedUnload);

            //Assert that the difference is an empty set
            foreach (var coinList in unaccountedForUnload.CoinsInCoinRacks)
            {
                Assert.IsTrue(coinList.Count == 0);
            }

            foreach (var popList in unaccountedForUnload.PopCansInPopCanRacks)
            {
                Assert.IsTrue(popList.Count == 0);
            }

            Assert.IsTrue(unaccountedForUnload.PaymentCoinsInStorageBin.Count == 0);



            //Mimic Continuation of test script
            VMs[0].LoadCoins(coinsToLoad);
            VMs[0].LoadPopCans(popsToLoad);
            VMs[0].CoinSlot.AddCoin(new Coin(100));
            VMs[0].CoinSlot.AddCoin(new Coin(100));
            VMs[0].CoinSlot.AddCoin(new Coin(100));
            VMs[0].SelectionButtons[0].Press();



            //Get Actual Delivery and set Expected Delivery
            delivered = new List <IDeliverable>(VMs[0].DeliveryChute.RemoveItems());
            expected.Clear();
            expected.Add(two5);
            expected.Add(two5);
            expected.Add(coke);


            //Compare Actual Delivery to Exepected Delivery
            foreach (var item in expected)
            {
                Assert.IsTrue(checker.contains(delivered, item));
                checker.remove(delivered, item);
            }

            Assert.IsTrue(delivered.Count == 0);



            //Get Actual Unload
            coinRacks = VMs[0].CoinRacks;
            foreach (var item in coinRacks)
            {
                actualUnload.CoinsInCoinRacks.Add(item.Unload());
            }

            popCanRacks = VMs[0].PopCanRacks;
            foreach (var item in popCanRacks)
            {
                actualUnload.PopCansInPopCanRacks.Add(item.Unload());
            }

            unload = VMs[0].StorageBin.Unload();
            foreach (var item in unload)
            {
                actualUnload.PaymentCoinsInStorageBin.Add(item);
            }


            //Set Expected Unload
            expectedCoinList = new List <Coin>()
            {
                five, ten, hund, hund, hund
            };
            expectedPopList = new List <PopCan>()
            {
                water, stuff
            };
            expectedUnload.CoinsInCoinRacks.Clear();
            expectedUnload.PopCansInPopCanRacks.Clear();
            expectedUnload.PaymentCoinsInStorageBin.Clear();
            expectedUnload.CoinsInCoinRacks.Add(expectedCoinList);
            expectedUnload.PopCansInPopCanRacks.Add(expectedPopList);


            //Compare Actual Unload with Expected Unload -- See Function Documentation for "checkUnload" in Checker.cs
            //--------------------------------------------------------------------------------------------------------
            //Remove all items from expected unload that are also in actual unload, return the difference (if any)
            unaccountedForUnload = checker.checkUnload(expectedUnload, actualUnload);

            //Assert that the difference is an empty set
            foreach (var coinList in unaccountedForUnload.CoinsInCoinRacks)
            {
                Assert.IsTrue(coinList.Count == 0);
            }

            foreach (var popList in unaccountedForUnload.PopCansInPopCanRacks)
            {
                Assert.IsTrue(popList.Count == 0);
            }

            Assert.IsTrue(unaccountedForUnload.PaymentCoinsInStorageBin.Count == 0);


            //Reset expected unload
            expectedUnload   = new VendingMachineStoredContents();
            expectedCoinList = new List <Coin>()
            {
                five, ten, hund, hund, hund
            };
            expectedPopList = new List <PopCan>()
            {
                water, stuff
            };
            expectedUnload.CoinsInCoinRacks.Clear();
            expectedUnload.PopCansInPopCanRacks.Clear();
            expectedUnload.PaymentCoinsInStorageBin.Clear();
            expectedUnload.CoinsInCoinRacks.Add(expectedCoinList);
            expectedUnload.PopCansInPopCanRacks.Add(expectedPopList);

            //Reverse the inputs to the function call to ensure neither expected nor actual contain different elements from eachother
            //Remove all items from actual unload that are also in expected unload, return the difference (if any)
            unaccountedForUnload = checker.checkUnload(actualUnload, expectedUnload);

            //Assert that the difference is an empty set
            foreach (var coinList in unaccountedForUnload.CoinsInCoinRacks)
            {
                Assert.IsTrue(coinList.Count == 0);
            }

            foreach (var popList in unaccountedForUnload.PopCansInPopCanRacks)
            {
                Assert.IsTrue(popList.Count == 0);
            }

            Assert.IsTrue(unaccountedForUnload.PaymentCoinsInStorageBin.Count == 0);



            /*
             *          foreach (var list in actualUnload.CoinsInCoinRacks)
             *          {
             *              foreach (var item in list)
             *              {
             *                  Console.WriteLine(item.Value);
             *              }
             *          }
             *
             *
             *          foreach (var list in actualUnload.PopCansInPopCanRacks)
             *          {
             *              foreach (var item in list)
             *              {
             *                  Console.WriteLine(item.Name);
             *              }
             *          }
             *
             *
             *          foreach (var item in actualUnload.PaymentCoinsInStorageBin)
             *          {
             *              Console.WriteLine(item.Value);
             *          }
             *
             *
             *          Console.WriteLine("------------------------");
             *
             *
             *
             *          foreach (var list in expectedUnload.CoinsInCoinRacks)
             *          {
             *              foreach (var item in list)
             *              {
             *                  Console.WriteLine(item.Value);
             *              }
             *          }
             *
             *
             *          foreach (var list in expectedUnload.PopCansInPopCanRacks)
             *          {
             *              foreach (var item in list)
             *              {
             *                  Console.WriteLine(item.Name);
             *              }
             *          }
             *
             *
             *          foreach (var item in expectedUnload.PaymentCoinsInStorageBin)
             *          {
             *              Console.WriteLine(item.Value);
             *          }
             *
             *
             *          Console.WriteLine("------------------------");
             *
             */
        }