Example #1
0
        [Test()] //тест строителя персоны
        public void Test6()
        {
            List <(double, double)> TermForfirstBank = new List <(double, double)>();

            TermForfirstBank.Add((10000, 0.1));
            TermForfirstBank.Add((20000, 0.2));

            Bank alfaBank = new Bank(TermForfirstBank, 0.1, 0.02, 10000, 1000);

            IAbstractBank firstBank = alfaBank;

            BuildPerson Andrey = new BuildPerson();

            Andrey.AddMainInfo("Anrey", "Loskutov");


            Adress       newAdress       = new Adress("Невского", 10, "Питер");
            PassportData firstPersonData = new PassportData(1111, 22222);

            Client clientAndrey = firstBank.CreateClient(Andrey.ReturnPersonInfo());

            firstBank.AddDebitAccount(clientAndrey, DateTime.Now);

            BankAccount firstAndreyAccount = clientAndrey.Accounts.ElementAt(0);

            firstBank.Replenishment(firstAndreyAccount, 2000);
            firstBank.CashWithdrawal(firstAndreyAccount, 1500);
            Assert.AreEqual(2000, firstAndreyAccount.AccountStatus);

            Andrey.AddPassportData(firstPersonData);
            Andrey.AddAdress(newAdress);

            firstBank.RefreshClientInfo(clientAndrey, Andrey.ReturnPersonInfo());//Необходимо обновить инфу о клиенте

            firstBank.CashWithdrawal(firstAndreyAccount, 1500);
            Assert.AreEqual(500, firstAndreyAccount.AccountStatus);
        }
Example #2
0
        static void Main(string[] args)
        {
            List <(double, double)> TermForfirstBank = new List <(double, double)>();

            TermForfirstBank.Add((10000, 0.1));
            TermForfirstBank.Add((20000, 0.2));

            Bank alfaBank = new Bank(TermForfirstBank, 0.1, 0.02, 10000, 3000);

            IAbstractBank firstBank = alfaBank;

            Adress       newAdress       = new Adress("Невского", 10, "Питер");
            PassportData firstPersonData = new PassportData(1111, 22222);
            //Person Andrey = new Person("Андрей", "Загудько", newAdress, firstPersonData);

            BuildPerson newInfo = new BuildPerson();

            newInfo.AddMainInfo("Andrey", "Loskutov");
            newInfo.AddAdress(newAdress);
            newInfo.AddPassportData(firstPersonData);
            Person Andrey = newInfo.ReturnPersonInfo();


            Client clientAndrey = firstBank.CreateClient(Andrey);

            firstBank.AddCreditAccount(clientAndrey, DateTime.Now);

            BankAccount firstAndreyAccount = clientAndrey.Accounts.ElementAt(0);

            firstBank.Replenishment(firstAndreyAccount, 1000);

            firstBank.CashWithdrawal(firstAndreyAccount, 1000);

            firstBank.CashWithdrawal(firstAndreyAccount, 200);

            Console.WriteLine(firstAndreyAccount.AccountStatus);
        }