コード例 #1
0
        public void TestOvermaken()
        {
            Bank bank            = new Bank("ing");
            int  rekeningNrJoris = bank.OpenRekening("Joris", "lops", "6a", "8944AM");
            int  rekeningNrDick  = bank.OpenRekening("Dick", "bruin", "20", "2334WW", 1000, 500);

            Rekening joris = bank.ZoekRekening(rekeningNrJoris);
            Rekening dick  = bank.ZoekRekening(rekeningNrDick);

            Assert.AreEqual(false, joris.GeldOvermaken(dick, 100)); //joris heeft geen geld dus kan niet overmaken
            Assert.AreEqual(true, dick.GeldOvermaken(joris, 1000));
            Assert.AreEqual(0, dick.Saldo);
            Assert.AreEqual(true, dick.GeldOvermaken(joris, 250));
            Assert.AreEqual(-250, dick.Saldo);
            Assert.AreEqual(false, dick.GeldOvermaken(joris, 10));
            Assert.AreEqual(-250, dick.Saldo);
        }
コード例 #2
0
        public void GeldOpnemen()
        {
            string bankNaam    = "TestBank";
            Bank   bank        = new Bank(bankNaam);
            int    rekeningNr0 = bank.OpenRekening("voornaam1", "achternaam2", "6a", "8944WW", startsaldo: 1000, salaris: 500);
            //kan 250 Euro rood staan (500/2)

            Rekening r0 = bank.ZoekRekening(rekeningNr0);

            Assert.AreEqual(true, r0.GeldOpnemen(500));
            Assert.AreEqual(500, r0.Saldo);
            Assert.AreEqual(false, r0.GeldOpnemen(-500));
            Assert.AreEqual(500, r0.Saldo);
            Assert.AreEqual(false, r0.GeldOpnemen(0));
            Assert.AreEqual(500, r0.Saldo);
            Assert.AreEqual(true, r0.GeldOpnemen(500));
            Assert.AreEqual(0, r0.Saldo);

            //rood staan
            Assert.AreEqual(true, r0.GeldOpnemen(125));
            Assert.AreEqual(-125, r0.Saldo);
            Assert.AreEqual(true, r0.GeldOpnemen(125));
            Assert.AreEqual(-250, r0.Saldo);

            //te veel rood staan
            Assert.AreEqual(false, r0.GeldOpnemen(10));
            Assert.AreEqual(-250, r0.Saldo);


            int      rekeningNr1 = bank.OpenRekening("voornaam2", "achternaam2", "6a", "8944WW", startsaldo: 1000);
            Rekening r1          = bank.ZoekRekening(rekeningNr1);

            //kan niet rood staan
            Assert.AreEqual(true, r1.GeldOpnemen(500));
            Assert.AreEqual(500, r1.Saldo);
            Assert.AreEqual(true, r1.GeldOpnemen(500));
            Assert.AreEqual(0, r1.Saldo);
            //proberen rood te staan
            Assert.AreEqual(false, r1.GeldOpnemen(10));
            Assert.AreEqual(0, r1.Saldo);
        }
コード例 #3
0
        public void RenteUitkeren()
        {
            Bank bank                    = new Bank("ing");
            int  rekeningNrJoris         = bank.OpenRekening("Joris", "lops", "6a", "8944AM");
            int  rekeningNrDick          = bank.OpenRekening("Dick", "bruin", "20", "2334WW", 1000, 500);
            int  rekeningNrJorisNegatief = bank.OpenRekening("Joris", "Lops", "20", "2334WW", 0, 1000);

            Rekening joris         = bank.ZoekRekening(rekeningNrJoris);
            Rekening dick          = bank.ZoekRekening(rekeningNrDick);
            Rekening jorisNegatief = bank.ZoekRekening(rekeningNrJorisNegatief);

            jorisNegatief.GeldOpnemen(500);
            Assert.AreEqual(-500, jorisNegatief.Saldo);

            decimal totaaluitgekeerd = bank.RenteUitkeren(5);

            Assert.AreEqual(50, totaaluitgekeerd);

            Assert.AreEqual(0, joris.Saldo);
            Assert.AreEqual(1050, dick.Saldo);
            Assert.AreEqual(-500, jorisNegatief.Saldo); //sociale bank
        }
コード例 #4
0
 public bool GeldOvermaken(Rekening rekening, decimal v)
 {
     return(GeldOpnemen(v) && rekening.GeldStorten(v));
 }