Ejemplo n.º 1
0
        public void TransferRaportTest()
        {
            //Arrange
            CKIR  KIR  = new CKIR();
            CBank bank = new CBank(KIR);

            bank.AddCustomer("Ivan", "Pavlov", 1);
            bank.StoreAccount(1, 1);

            bank.AddCustomer("Rafal", "Swierczewsky", 2);
            bank.StoreAccount(2, 2);

            bank.PayIn(bank.GetAccount(1), 600m);
            bank.Transfer(bank.GetAccount(1), bank.GetAccount(2), 500m);    //TRANSFER
            bank.PayIn(bank.GetAccount(1), 500m);
            bank.PayIn(bank.GetAccount(1), 500m);
            bank.Transfer(bank.GetAccount(1), bank.GetAccount(2), 500m);    //TRANSFER
            bank.WithDraw(bank, bank.GetAccount(1), 500m);
            bank.PayIn(bank.GetAccount(1), 500m);
            bank.PayIn(bank.GetAccount(1), 500m);
            bank.WithDraw(bank, bank.GetAccount(1), 500m);

            IRaport transferraport = new CTransferRaport();
            string  temp           = transferraport.accept(new CRaportDisplayVisitor(), bank.GetAccount(1).GetHistory());
            string  expected       = "500-TRANSFER...500-TRANSFER";

            //Assert
            Assert.AreEqual(temp, expected);
        }
Ejemplo n.º 2
0
        public void WithDrawGoodTest()
        {
            //Arrange
            CKIR  KIR  = new CKIR();
            CBank bank = new CBank(KIR);

            bank.AddCustomer("Ivan", "Pavlov", 1);
            bank.StoreAccount(1, 1);

            bank.PayIn(bank.GetAccount(1), 500m);
            bank.WithDraw(bank, bank.GetAccount(1), 250m);

            //Assert
            Assert.AreEqual(bank.GetAccount(1).GetSaldo(), 250m);
        }
Ejemplo n.º 3
0
        public void PayInRaportTest()
        {
            //Arrange
            CKIR  KIR  = new CKIR();
            CBank bank = new CBank(KIR);

            bank.AddCustomer("Ivan", "Pavlov", 1);
            bank.StoreAccount(1, 1);

            bank.PayIn(bank.GetAccount(1), 500m);   //PAYIN
            bank.PayIn(bank.GetAccount(1), 500m);   //PAYIN
            bank.WithDraw(bank, bank.GetAccount(1), 500m);
            bank.PayIn(bank.GetAccount(1), 500m);   //PAYIN
            bank.PayIn(bank.GetAccount(1), 500m);   //PAYIN
            bank.WithDraw(bank, bank.GetAccount(1), 500m);

            IRaport payinraport = new CPayInRaport();
            string  temp        = payinraport.accept(new CRaportDisplayVisitor(), bank.GetAccount(1).GetHistory());
            string  expected    = "500-PAYIN...500-PAYIN...500-PAYIN...500-PAYIN";

            //Assert
            Assert.AreEqual(bank.GetAccount(1).GetSaldo(), 1000m);
            Assert.AreEqual(temp, expected);
        }