public void FindBankAccountsReturnAllItems() { var bankAccountRepository = new StubIBankAccountRepository(); bankAccountRepository.GetAll = () => { var customer = new Customer(); customer.GenerateNewIdentity(); var bankAccount = new BankAccount() { BankAccountNumber = new BankAccountNumber("4444", "5555", "3333333333", "02"), }; bankAccount.SetCustomerOwnerOfThisBankAccount(customer); bankAccount.GenerateNewIdentity(); var accounts = new List<BankAccount>() { bankAccount }; return accounts; }; var customerRepository = new StubICustomerRepository(); IBankTransferService transferService = new BankTransferService(); IBankAppService bankingService = new BankAppService(bankAccountRepository, customerRepository, transferService); //Act var result = bankingService.FindBankAccounts(); Assert.IsNotNull(result); Assert.IsTrue(result.Count == 1); }
public void FindBankAccountsReturnAllItems() { SIBankAccountRepository bankAccountRepository = new SIBankAccountRepository(); bankAccountRepository.GetAll = ()=> { var accounts = new List<BankAccount>() { new BankAccount() { Id = Guid.NewGuid(), BankAccountNumber = new BankAccountNumber("4444", "5555", "3333333333", "02"), CustomerId =Guid.NewGuid() } }; return accounts; }; SICustomerRepository customerRepository = new SICustomerRepository(); IBankTransferService transferService = new BankTransferService(); ITypeAdapter adapter = PrepareTypeAdapter(); IBankAppService bankingService = new BankAppService(bankAccountRepository, customerRepository, transferService, adapter); //Act var result = bankingService.FindBankAccounts(); Assert.IsNotNull(result); Assert.IsTrue(result.Count == 1); }