public void ShouldReturnSearchSettings(ISearchResults searchResults,[Substitute] SearchService service, SearchSettings searchSettings, ISearchServiceRepository serviceRepository, ISearchSettingsRepository settingsRepository, QueryRepository queryRepository,   IRenderingPropertiesRepository renderingPropertiesRepository, string query)
 {
   settingsRepository.Get(Arg.Any<string>()).Returns(searchSettings);
   var controller = new SearchController(serviceRepository, settingsRepository, queryRepository, renderingPropertiesRepository);
   var result = controller.SearchSettings(query) as ViewResult;
   result.Model.Should().BeOfType<SearchSettings>();
 }
Esempio n. 2
0
 public void SearchResultsHeader_ShouldReturnModel(ISearchResults searchResults, [Substitute]SearchService service, SearchContext searchContext, ISearchServiceRepository serviceRepository, ISearchContextRepository contextRepository, QueryRepository queryRepository, IRenderingPropertiesRepository renderingPropertiesRepository, string query)
 {
   contextRepository.Get().Returns(searchContext);
   var controller = new SearchController(serviceRepository, contextRepository, queryRepository, renderingPropertiesRepository);
   var result = controller.SearchResultsHeader(query) as ViewResult;
   result.Model.Should().BeOfType<SearchContext>();
 }
Esempio n. 3
0
 public void ShouldReturnGlobalSearch(ISearchResults searchResults, [Substitute] SearchService service, ISearchServiceRepository serviceRepository, ISearchSettingsRepository settingsRepository, QueryRepository queryRepository, IRenderingPropertiesRepository renderingPropertiesRepository, string query)
 {
   service.Search(Arg.Any<IQuery>()).Returns(searchResults);
   serviceRepository.Get().Returns(service);
   var controller = new SearchController(serviceRepository, settingsRepository, queryRepository, renderingPropertiesRepository);
   var result = controller.GlobalSearch() as ViewResult;
   result.Model.Should().As<ISearchResults>();
 }
 public void ShouldReturnPagedSearchResult([Substitute] SearchService service, ISearchServiceRepository serviceRepository, ISearchSettingsRepository settingsRepository, QueryRepository queryRepository, string query, ISearchResults searchResults, [Substitute] SearchController searchController, IRenderingPropertiesRepository renderingPropertiesRepository, [Substitute] PagingSettings pagingSettings)
 {
   renderingPropertiesRepository.Get<PagingSettings>().Returns(pagingSettings);
   service.Search(Arg.Any<IQuery>()).Returns(searchResults);
   serviceRepository.Get().Returns(service);
   var controller = new SearchController(serviceRepository, settingsRepository, queryRepository, renderingPropertiesRepository);
   var result = controller.PagedSearchResults(query, null) as ViewResult;
   result.Model.Should().BeOfType<PagedSearchResults>();
 }
Esempio n. 5
0
 public void SearchResults_ShouldReturnModel([Substitute]ControllerContext controllerContext, [Substitute]HttpContextBase context, ISearchResults searchResults, [Substitute]SearchService service, ISearchServiceRepository serviceRepository, ISearchContextRepository contextRepository, QueryRepository queryRepository, IRenderingPropertiesRepository renderingPropertiesRepository, string query)
 {
   service.Search(Arg.Any<IQuery>()).Returns(searchResults);
   serviceRepository.Get().Returns(service);
   var controller = new SearchController(serviceRepository, contextRepository, queryRepository, renderingPropertiesRepository)
                    {
                      ControllerContext = controllerContext
                    };
   controller.ControllerContext.HttpContext = context;
   var result = controller.SearchResults(query) as ViewResult;
   result.Model.Should().As<ISearchResults>();
 }