コード例 #1
0
        [Test()] //Тестируем пополнение и снятие средств с счетов
        public void Test1()
        {
            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.2, 10000, 3000);

            IAbstractBank firstBank = alfaBank;

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

            Client clientAndrey = firstBank.CreateClient(Andrey);

            firstBank.AddDebitAccount(clientAndrey, DateTime.Now);

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

            firstBank.Replenishment(firstAndreyAccount, 1000); //Закидываем деньги на аккаунт

            Assert.AreEqual(1000, firstAndreyAccount.AccountStatus);

            firstBank.CashWithdrawal(firstAndreyAccount, 200); //Снимаем деньги с аккаунта

            Assert.AreEqual(800, firstAndreyAccount.AccountStatus);

            firstBank.CashWithdrawal(firstAndreyAccount,
                                     1100); //Снимаем больше чем имеем, поскольку аккаунт дебитовый деньги не снимутся

            Assert.AreEqual(800, firstAndreyAccount.AccountStatus);
        }
コード例 #2
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);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: TomGnill/ITMO_OOP_2020
        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);
        }
コード例 #4
0
        [Test()] //по всей видимости не лишним будет протестировать кредитный аккаунт
        public void Test5()
        {
            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);

            Client clientAndrey = firstBank.CreateClient(Andrey);

            firstBank.AddCreditAccount(clientAndrey, DateTime.Now);

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

            firstBank.CashWithdrawal(firstAndreyAccount, 200);
            Assert.AreEqual(-220, firstAndreyAccount.AccountStatus); //снимали 200, тк наш счёт 0,  комиссия 10% ещё -20 на наш счёт
        }