コード例 #1
0
        public void Test_SuccessfulPurchase()
        {
            ApolloNorth.VendingMachine vm = new ApolloNorth.VendingMachine(1, 50);
            var result = vm.BuyDrink();

            Assert.IsTrue(result.Contains("CAN Dispensed"));
        }
コード例 #2
0
        public void Test_Inventory_Balance_Total()
        {
            ApolloNorth.VendingMachine vm = new ApolloNorth.VendingMachine(25, 250);
            var result = vm.ToString();

            Assert.AreEqual(result, "Total Inventory: 25      Account Amount: 250p");
        }
コード例 #3
0
        public void Test_InsufficientAmountForPurchase()
        {
            ApolloNorth.VendingMachine vm = new ApolloNorth.VendingMachine(1, 0);
            var result = vm.BuyDrink();

            Assert.IsTrue(result == "Insufficient fund in Account");
        }
コード例 #4
0
        public void Test_Pin_Invalid()
        {
            ApolloNorth.VendingMachine vm = new ApolloNorth.VendingMachine();
            vm.SuppliedPin = "145";
            var result = vm.ValidatePin();

            Assert.IsFalse(result == "Invalid Card Pin");
        }
コード例 #5
0
        public void Test_Pin_Valid()
        {
            ApolloNorth.VendingMachine vm = new ApolloNorth.VendingMachine();
            vm.SuppliedPin = "01234";
            var result = vm.ValidatePin();

            Assert.IsTrue(result == "OK");
        }
コード例 #6
0
        public void Test_ZeroQuantityInventory_ZeroAmount()
        {
            ApolloNorth.VendingMachine vm = new ApolloNorth.VendingMachine(0, 0);
            var result = vm.BuyDrink();

            Assert.IsTrue(result == "Inventory Out of Stock");

            Assert.AreEqual(result, "Inventory Out of Stock");
        }
コード例 #7
0
 public void Test_WorkingConstructor()
 {
     ApolloNorth.VendingMachine vm = new ApolloNorth.VendingMachine(25, 250);
     Assert.AreEqual(vm.NumberOfCan, 25);
     Assert.AreEqual(vm.AccountBalance, 250);
 }