Example #1
0
        public void ChargeTest_RemovesProperAmount()
        {
            InventoryReader inventoryReader = new InventoryReader();
            Dictionary <string, VendingMachineItem> inventory = inventoryReader.ReadInventory();

            VendingMachineBrain happyRoad = new VendingMachineBrain(inventory);

            happyRoad.FeedMoney(5);
            happyRoad.AddToCart("A1");
            happyRoad.Charge();
            Assert.AreEqual(1.95M, happyRoad.Balance, "Item added updates the balance");
        }
Example #2
0
        public void ChangeTest_ReturnsBalanceToZero()
        {
            InventoryReader inventoryReader = new InventoryReader();
            Dictionary <string, VendingMachineItem> inventory = inventoryReader.ReadInventory();

            VendingMachineBrain happyRoad = new VendingMachineBrain(inventory);

            happyRoad.FeedMoney(5);
            happyRoad.AddToCart("A1");
            happyRoad.Charge();
            happyRoad.Change();
            Assert.AreEqual(0, happyRoad.Balance, "Updates balance to zero.");
        }