public void BalanceIsCorrectAfterDeposit() { var fakeDb = new FakeApplicationDbContext(); fakeDb.CheckingAccounts = new FakeDbSet<CheckingAccount>(); var checkingAccount = new CheckingAccount { Id = 1, AccountNumber = "000123TEST", Balance = 0 }; fakeDb.CheckingAccounts.Add(checkingAccount); fakeDb.Transactions = new FakeDbSet<Transaction>(); var transactionController = new TransactionController(fakeDb); transactionController.Deposit(new Transaction { CheckingAccountId = 1, Amount = 25 }); //checkingAccount.Balance = 25; Assert.AreEqual(25, checkingAccount.Balance); }
public void CreateCheckingAccount(string firstName, string lastName, string userId, decimal initialBalance) { var accountNumber = (123456 + db.CheckingAccounts.Count()).ToString().PadLeft(10, '0'); var checkingAccount = new CheckingAccount { FirstName = firstName, LastName = lastName, AccountNumber = accountNumber, Balance = 0, ApplicationUserId = userId }; db.CheckingAccounts.Add(checkingAccount); db.SaveChanges(); }