Exemplo n.º 1
0
        public void PositiveTestAddFunds()
        {
            var account = new SavingsAccount("acc1", "client1");
            var result1 = account.AddFunds(100M);
            var result2 = account.AddFunds(0M);

            Assert.AreEqual(true, result1);
            Assert.AreEqual(true, result2);
            Assert.AreEqual(100M, account.AccountBalance);
        }
Exemplo n.º 2
0
        public void NegativeTestAddFunds()
        {
            var account1 = new SavingsAccount("acc1", "client1");
            var result1  = account1.AddFunds(-100M);
            var account2 = new SavingsAccount("acc2", "client2");
            var result2  = account2.CloseAccount();
            var result3  = account2.AddFunds(100M);

            Assert.AreEqual(false, result1);
            Assert.AreEqual(0M, account1.AccountBalance);
            Assert.AreEqual(true, result2);
            Assert.AreEqual(false, result3);
            Assert.AreEqual(0M, account1.AccountBalance);
        }
Exemplo n.º 3
0
        public void NegativeTestCloseAccount()
        {
            var account = new SavingsAccount("acc1", "client1");

            account.AddFunds(100M);
            var result1 = account.CloseAccount();

            account.ZeroingAccount();
            account.CloseAccount();
            var result2 = account.CloseAccount();

            Assert.AreEqual(false, result1);
            Assert.AreEqual(false, result2);
        }
Exemplo n.º 4
0
        public void NegativeTestWithdrawFunds()
        {
            var account = new SavingsAccount("acc1", "client1");

            account.AddFunds(100M);
            var result1 = account.WithdrawFunds(500M);
            var result2 = account.WithdrawFunds(-50M);

            Assert.AreEqual(false, result1);
            Assert.AreEqual(false, result2);
            Assert.AreEqual(100M, account.AccountBalance);

            account.WithdrawFunds(100M);
            var result3 = account.WithdrawFunds(10M);

            Assert.AreEqual(false, result3);
            Assert.AreEqual(0M, account.AccountBalance);

            account.CloseAccount();
            var result4 = account.WithdrawFunds(10M);

            Assert.AreEqual(false, result4);
            Assert.AreEqual(0M, account.AccountBalance);
        }