public When_EmployerService_Is_Called_To_Search() { var employerRepository = Substitute.For <IRepository <Domain.Models.Employer> >(); var opportunityRepository = Substitute.For <IOpportunityRepository>(); employerRepository.GetManyAsync(Arg.Any <Expression <Func <Domain.Models.Employer, bool> > >()) .Returns(new SearchResultsBuilder().Build().AsQueryable()); var employerService = new EmployerService(employerRepository, opportunityRepository, AutoMapperExtension.GetRealMapper(), Substitute.For <IValidator <CrmEmployerEventBase> >(), Substitute.For <IMessageQueueService>()); const string companyName = "Co"; _searchResults = employerService.Search(companyName).ToList(); _firstEmployer = _searchResults[0]; _secondEmployer = _searchResults[1]; _thirdEmployer = _searchResults[2]; }