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