Exemple #1
0
        public void FileLoaderTest(string filePath)
        {
            //Arrange
            VMInventoryLoader vMInventoryLoader = new VMInventoryLoader();

            //Act
            List <Product> actual = vMInventoryLoader.StockProducts();

            //Assess
            CollectionAssert.AllItemsAreNotNull(actual);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            VMInventoryLoader vMInventoryLoader = new VMInventoryLoader();

            vMInventoryLoader.StockProducts();

            IEnumerable <Product> products = vMInventoryLoader.StockProducts();

            VendingMachine vendingMachine = new VendingMachine(products);

            MainMenu mainMenu = new MainMenu(vendingMachine);
        }
        public void BuyProduct(int expectedQuantity)
        {
            //Arrange
            VMInventoryLoader vMInventoryLoader = new VMInventoryLoader();

            vMInventoryLoader.StockProducts();

            IEnumerable <Product> products = vMInventoryLoader.StockProducts();

            VendingMachine vendingMachine = new VendingMachine(products);

            string  userInputKey = "A1";
            Product product      = vendingMachine.vendingMachineInventory[userInputKey];

            //Act
            vendingMachine.PurchaseProduct(product);

            //Assert
            Assert.AreEqual(product.Quantity, expectedQuantity);
        }
Exemple #4
0
        public void MoneyIncrementerTest(int moneyInput, int expectedValue)
        {
            //Arrange
            VMInventoryLoader vMInventoryLoader = new VMInventoryLoader();

            vMInventoryLoader.StockProducts();

            IEnumerable <Product> products = vMInventoryLoader.StockProducts();

            VendingMachine vendingMachine = new VendingMachine(products);

            decimal decMoneyInput = (decimal)(moneyInput);

            decimal decExpectedValue = (decimal)(expectedValue);

            //Act
            vendingMachine.FeedMoneyToCurrentBalance(decMoneyInput);

            //Assert
            Assert.AreEqual(vendingMachine.CurrentMoneyProvided, decExpectedValue);
        }
        public void BalanceToZero(int initialBalance, int expectedBalance)
        {
            //Arrange
            VMInventoryLoader vMInventoryLoader = new VMInventoryLoader();

            vMInventoryLoader.StockProducts();

            IEnumerable <Product> products = vMInventoryLoader.StockProducts();

            VendingMachine vendingMachine = new VendingMachine(products);

            decimal decInitialBalance  = (decimal)(initialBalance);
            decimal decExpectedBalance = (decimal)(expectedBalance);

            //Act
            vendingMachine.CurrentMoneyProvided += decInitialBalance;
            vendingMachine.ReturnChange();

            //Assert

            Assert.AreEqual(vendingMachine.CurrentMoneyProvided, decExpectedBalance);
        }