[Test] // 2 public void GetBankAccounts_ReturnsAListContainingAddedBankAccount_WhenCalled() { //Arrange BankAccountRepository bankAccountRepository = new BankAccountRepository(context); BankAccountType bankAccountType1 = new BankAccountType { BankAccountTypeId = 1, BankAccountTypeName = "Saving Account" }; context.BankAccountTypes.Add(bankAccountType1); BankAccount expected = new BankAccount { CustomerId = 1, BankAccountTypeId = 1, Interestrate = 0 }; context.BankAccounts.Add(expected); context.SaveChanges(); //Act var actual = bankAccountRepository.GetAllBankAccounts().ToList().ElementAt(0); //Assert Assert.AreEqual(expected, actual); }
//2 Get all Bank Accounts in Data Base public List <BankAccount> GetAllBankAccounts() { return(bankAccountRepository.GetAllBankAccounts()); }