示例#1
0
        public void When_Account_Is_Closed_Any_Actions_Are_Forbidden_Test()
        {
            IBank    bank       = new Bank();
            Currency pln        = new Currency("PLN");
            var      currencies = new List <Currency>();

            currencies.Add(pln);
            Guid         id          = Guid.NewGuid();
            Guid         userId      = Guid.NewGuid();
            IBankAccount bankAccount = bank.CreateBankAccount(id, userId, currencies);

            bankAccount.Deposit(pln, new Money(1m, "PLN"));
            bankAccount.Deposit(pln, new Money(200m, "PLN"));
            bankAccount.Deposit(pln, new Money(300m, "PLN"));
            bankAccount.Deposit(pln, new Money(500m, "PLN"));
            bankAccount.VerifyAccount();
            bankAccount.Deposit(pln, new Money(1000m, "PLN"));
            bankAccount.Deposit(pln, new Money(2000m, "PLN"));
            bankAccount.Withdraw(pln, new Money(100m, "PLN"));
            bankAccount.Deposit(pln, new Money(3000m, "PLN"));
            bankAccount.Withdraw(pln, new Money(100m, "PLN"));
            bankAccount.Deposit(pln, new Money(5000m, "PLN"));
            bankAccount.Withdraw(pln, new Money(100m, "PLN"));

            bankAccount.CloseAccount();

            try
            {
                bankAccount.GetBalance(pln);
            }
            catch
            {
                Assert.IsTrue(true);
                return;
            }

            Assert.Fail();
        }