Example #1
0
        public void CheckBalance_InvalidTest()
        {
            FinanceManager financeManager = new FinanceManager();

            FinantialDB.Accounts.Clear();
            financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true);
            IAccount account = FinantialDB.Accounts.Values.ToList()[0];

            Assert.Throws <KeyNotFoundException>(() => financeManager.CheckBalance(Guid.NewGuid()));
        }
Example #2
0
        public void CheckBalance_ValidTest()
        {
            FinanceManager financeManager = new FinanceManager();

            FinantialDB.Accounts.Clear();
            financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true);
            financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true);
            financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true);
            financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true);
            financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true);
            financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true);
            financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true);
            financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true);
            IAccount account = FinantialDB.Accounts.Values.ToList()[0];

            account.Balance = 500;
            double balance  = account.Balance;
            double balance2 = financeManager.CheckBalance(account.ID);

            Assert.AreEqual(balance, balance2);
        }