public void GetById_Non_Existing_Account_Expect_Null_Test() { //IRepository<IBankAccount, int> repository = new BankAccountRepository(); BankAccountController mgr = new BankAccountController(repository); ICustomer customer1 = new Customer(1, "Name", "Address", "Phone", "Email"); IBankAccount account1 = mgr.CreateNewBankAccount(customer1); IBankAccount result = mgr.GetBankAccountById(2); Assert.IsNull(result); }
public void GetById_Existing_Account_Test() { //IRepository<IBankAccount, int> repository = new BankAccountRepository(); BankAccountController mgr = new BankAccountController(repository); ICustomer customer1 = new Customer(1, "Name", "Address", "Phone", "Email"); ICustomer customer2 = new Customer(2, "Name", "Address", "Phone", "Email"); IBankAccount account1 = mgr.CreateNewBankAccount(customer1); IBankAccount account2 = mgr.CreateNewBankAccount(customer2); IBankAccount result = mgr.GetBankAccountById(account2.AccountNumber); Assert.IsNotNull(result); Assert.AreSame(account2, result); }