public void Find_emptyNameAndValidTitle_CallsFindByJobTitleRepositoryMethod() { var employeeRepository = MockRepository.GenerateMock<IEmployeeRepository>(); var provider = new EmployeeProvider(employeeRepository, _jobTitleProvider); provider.Find(null, TitleId); employeeRepository.AssertWasCalled(r => r.FindByJobTitle(_jobTitle)); }
public void Find_validNameAndNullTitle_CallsListAllRepositoryMethod() { var employeeRepository = MockRepository.GenerateMock<IEmployeeRepository>(); var jobTitleProvider = MockRepository.GenerateStub<IJobTitleProvider>(); var provider = new EmployeeProvider(employeeRepository, jobTitleProvider); provider.Find(Name, 0); employeeRepository.AssertWasCalled(r => r.ListAll()); }
public void GetById_validId_callsRepository() { var employeeRepository = MockRepository.GenerateMock<IEmployeeRepository>(); employeeRepository.Stub(e => e.GetById(EmployeeId)).Return(_employee); var jobTitleProvider = MockRepository.GenerateStub<IJobTitleProvider>(); var provider = new EmployeeProvider(employeeRepository, jobTitleProvider); var results = provider.GetById(EmployeeId); employeeRepository.AssertWasCalled(e => e.GetById(EmployeeId)); }
public void Find_validNameAndNullTitle_FiltersResultsByName() { var employeeRepository = MockRepository.GenerateMock<IEmployeeRepository>(); employeeRepository.Stub(e => e.ListAll()).Return(GenerateListOfEmployees()); var jobTitleProvider = MockRepository.GenerateStub<IJobTitleProvider>(); var provider = new EmployeeProvider(employeeRepository, jobTitleProvider); var results = provider.Find(Name, 0); Assert.That(results.Count == 2); }