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 }); Assert.AreEqual(25, checkingAccount.Balance); }
public void BalanceIsCorrectAfterDeposit() { var fakeDb = new FakeApplicationDbContext(); fakeDb.CheckingAccounts = new FakeDbSet <CheckingAccount>(); var checkingAccount = new CheckingAccount { Id = 10, AccountNumber = "000000TEST", Balance = 0 }; fakeDb.Transactions = new FakeDbSet <Transaction>(); var transactionsController = new TransactionController(fakeDb); transactionsController.Deposit(new Transaction { CheckingAccountId = 10, Amount = 25 }); // checkingAccount.Balance = 25; Assert.AreEqual(25, checkingAccount.Balance); }
public void ReturnCorrectEmailAfterSearch() { var fakeDb = new FakeApplicationDbContext(); fakeDb.FoundInformation = new FakeDbSet <FoundInformation>(); var foundInformation = new FoundInformation { Email = "*****@*****.**", Username = "******" }; fakeDb.FoundInformation.Add(foundInformation); FoundInformationController foundInformationController = new FoundInformationController(fakeDb); var returnedResult = (PartialViewResult)foundInformationController.Details(new Search { SearchTerm = "User1" }); //https://stackoverflow.com/questions/55449065/how-can-i-get-the-index-of-a-viewresult var foundInfoEmail = returnedResult.Model as List <FoundInformation>; Assert.AreEqual("*****@*****.**", foundInfoEmail[0].Email); }
public void BalanceIsCorrectAfterDeposit() { var fakeDb = new FakeApplicationDbContext(); fakeDb.CheckingAccounts = new FakeDbSet <CheckingAccount>(); var checkingAccount = new CheckingAccount { Id = 1, AccountNumber = "0123TEST", Balance = 0 }; fakeDb.CheckingAccounts.Add(checkingAccount); fakeDb.Transactions = new FakeDbSet <Transaction>(); var transactionController = new TransactionController(fakeDb); var deposit = new Transaction { CheckingAccountId = 1, Amount = 100 }; transactionController.Deposit(deposit); Assert.AreEqual(100, checkingAccount.Balance); }