Exemple #1
0
 public void OwnConstructor_04()
 {
     int[] moneyInDepot = { 1, 2, 3, 4, 5, 6, 7 };
     Logic.ChangeMachine changeMachine = new Logic.ChangeMachine(moneyInDepot);
     moneyInDepot[0] = 10;
     Assert.AreEqual(28, changeMachine.MoneyInDepot, "1-7 Einheiten sollen im Depot sein");
 }
 public ChangeMachineModel()
 {
     ChangeMachine  = new Logic.ChangeMachine();
     ValuesInDepot  = new int[moneyValues.Length];
     ValuesInInsert = new int[moneyValues.Length];
     ValuesInSelect = new int[moneyValues.Length];
     ValuesInEject  = new int[moneyValues.Length];
     Update();
 }
Exemple #3
0
 public void InsertMoney_01()
 {
     int[] moneyUnits   = { 1, 2, 5, 10, 20, 50, 100 };
     int[] moneyInDepot = { 1, 2, 3, 4, 5, 6, 7 };
     Logic.ChangeMachine changeMachine = new Logic.ChangeMachine(moneyInDepot);
     for (int i = 0; i < moneyUnits.Length; i++)
     {
         Assert.AreEqual(true, changeMachine.InsertMoney(moneyUnits[i]), $"{moneyUnits[i]} is valid");
     }
 }
Exemple #4
0
        public void NormalChange_02()
        {
            int[] moneyInDepot   = { 001, 002, 005, 010, 020, 050, 100 };
            int[] changeExpected = { 000, 000, 000, 000, 001, 000, 000 };
            int[] depotExpected  = { 001, 002, 005, 012, 019, 050, 100 };
            Logic.ChangeMachine changeMachine = new Logic.ChangeMachine(moneyInDepot);
            bool ok = changeMachine.InsertMoney(10);

            Assert.IsTrue(ok, "InsertMoney sollte funktionieren");
            ok = changeMachine.InsertMoney(10);
            Assert.IsTrue(ok, "InsertMoney sollte funktionieren");
            changeMachine.Change();
            Assert.IsTrue(CompareArrays(changeMachine.EmptyEjection(), changeExpected), "Wechselgeld stimmt nicht!");
            Assert.IsTrue(CompareArrays(changeMachine.EmptyDepot(), depotExpected), "Wechselgeld stimmt nicht!");
        }
Exemple #5
0
 public void DefaultConstructor_01()
 {
     Logic.ChangeMachine changeMachine = new Logic.ChangeMachine();
     Assert.AreEqual(210, changeMachine.MoneyInDepot, "Je Wert sollen 30 Einheiten im Depot sein");
 }