示例#1
0
        public void VisitTest4()
        {
            Bank       bank        = new Bank("1");
            Client     client1     = new Client("Jan", "Nowak", "01234567891");
            Investment investment1 = new Investment("1", new InterestZero(), 1100, client1);
            Client     client2     = new Client("Jan", "Kowalski", "01234567892");
            Investment investment2 = new Investment("2", new InterestZero(), 500, client2);

            AddBankProduct addBankProduct1 = new AddBankProduct(bank, investment1);

            bank.DoOperation(addBankProduct1);

            AddBankProduct addBankProduct2 = new AddBankProduct(bank, investment2);

            bank.DoOperation(addBankProduct2);

            IReport             report       = new BankProductByClientNIP("01234567891");
            List <IBankProduct> bankProdusts = new List <IBankProduct>();

            bankProdusts = bank.DoReport(report);

            Assert.AreEqual(1, bankProdusts.Count);

            Assert.AreEqual("Nowak", bankProdusts[0].GetClient().GetSurname());
        }
        public void VisitTest2()
        {
            Bank         bank         = new Bank("1");
            Client       client1      = new Client("Jan", "Nowak", "01234567891");
            IBankProduct bankAccount1 = new BankAccount("1", new InterestZero(), 1100, client1);

            bankAccount1 = new BankAccountDebet((BankAccount)bankAccount1, 100);
            Client       client2      = new Client("Jan", "Kowalski", "01234567892");
            IBankProduct bankAccount2 = new BankAccount("2", new InterestZero(), 500, client2);

            bankAccount2 = new BankAccountDebet((BankAccount)bankAccount2, 100);

            AddBankProduct addBankProduct1 = new AddBankProduct(bank, bankAccount1);

            bank.DoOperation(addBankProduct1);

            AddBankProduct addBankProduct2 = new AddBankProduct(bank, bankAccount2);

            bank.DoOperation(addBankProduct2);

            IReport             report       = new BankAccountSaldoOver1000();
            List <IBankProduct> bankProdusts = new List <IBankProduct>();

            bankProdusts = bank.DoReport(report);

            Assert.AreEqual(1, bankProdusts.Count);

            Assert.AreEqual("01234567891", bankProdusts[0].GetClient().GetClientNIP());
        }
示例#3
0
        public void ExecuteTest()
        {
            Bank bank = new Bank(Bank.GetFreeBanktId());

            string clientId = bank.GetFreeBankProductId();
            Client client   = new Client("Jan", "Nowak", "01234567891");

            string      accountId   = bank.GetFreeBankProductId();
            BankAccount bankAccount = new BankAccount(accountId, new InterestTenPercent(), 1000, client);

            AddBankProduct addBankProduct = new AddBankProduct(bank, bankAccount);

            bank.DoOperation(addBankProduct);

            BankProduct.IBankProduct product = bank.GetBankProductById(accountId);
            Assert.AreNotEqual(null, product);
        }
示例#4
0
        public void SendTest()
        {
            Bank bank1 = new Bank("1");
            Bank bank2 = new Bank("2");

            System.Console.WriteLine(bank1.GetBankId());
            System.Console.WriteLine(bank2.GetBankId());

            string bank1ClientId = bank1.GetFreeBankProductId();
            Client bank1Client   = new Client("Jan", "Nowak", "1234567891");

            string bank2ClientId = bank2.GetFreeBankProductId();
            Client bank2Client   = new Client("Jan", "Nowak", "1234567892");

            string bank1AccountId = bank1.GetFreeBankProductId();
            string bank2AccountId = bank2.GetFreeBankProductId();

            BankAccount bank1Account = new BankAccount(bank1AccountId, new InterestZero(), 1000, bank1Client);
            BankAccount bank2Account = new BankAccount(bank2AccountId, new InterestZero(), 1000, bank2Client);

            AddBankProduct addBa1 = new AddBankProduct(bank1, bank1Account);
            AddBankProduct addBa2 = new AddBankProduct(bank2, bank2Account);

            bank1.DoOperation(addBa1);
            bank2.DoOperation(addBa2);

            KIR kir = new KIR();

            kir.addBank(bank1);
            kir.addBank(bank2);

            kir.Send(bank1Account.GetProductId(), bank2Account.GetProductId(), 500);

            System.Console.WriteLine(bank1Account.GetSaldo());
            System.Console.WriteLine(bank2Account.GetSaldo());

            Assert.AreEqual(bank1Account.GetSaldo(), 500);
            Assert.AreEqual(bank2Account.GetSaldo(), 1500);
        }
        public void VisitTest3()
        {
            Bank   bank    = new Bank("1");
            Client client1 = new Client("Jan", "Nowak", "01234567891");
            Credit credit1 = new Credit("1", new InterestZero(), 1100, client1);
            Client client2 = new Client("Jan", "Kowalski", "01234567892");
            Credit credit2 = new Credit("2", new InterestZero(), 500, client2);

            AddBankProduct addBankProduct1 = new AddBankProduct(bank, credit1);

            bank.DoOperation(addBankProduct1);

            AddBankProduct addBankProduct2 = new AddBankProduct(bank, credit2);

            bank.DoOperation(addBankProduct2);

            IReport             report       = new BankAccountSaldoOver1000();
            List <IBankProduct> bankProdusts = new List <IBankProduct>();

            bankProdusts = bank.DoReport(report);

            Assert.AreEqual(0, bankProdusts.Count);
        }