public void Test_CreateSearchComponent_Positive()
        {
            ISearchComponentFactory serviceFactory  = new SearchComponentFactory();
            ISearchComponent        SearchComponent = serviceFactory.CreateSearchComponent(DataSources.Flicker);

            Assert.IsTrue(SearchComponent is FlickerSearchSearchComponent);

            ISearchComponent SearchComponent2 = serviceFactory.CreateSearchComponent(DataSources.Flicker);

            Assert.IsTrue(SearchComponent2 is FlickerSearchSearchComponent);
            Assert.AreSame(SearchComponent, SearchComponent2);

            ISearchComponent SearchComponent3 = serviceFactory.CreateSearchComponent(DataSources.Flicker);

            Assert.IsTrue(SearchComponent3 is FlickerSearchSearchComponent);
            Assert.AreSame(SearchComponent, SearchComponent3);

            ISearchComponent SearchComponent4 = serviceFactory.CreateSearchComponent(DataSources.NewsAPI);

            Assert.IsTrue(SearchComponent4 is NewsAPISearchhComponent);

            ISearchComponent SearchComponent5 = serviceFactory.CreateSearchComponent(DataSources.NewsAPI);

            Assert.IsTrue(SearchComponent5 is NewsAPISearchhComponent);
            Assert.AreSame(SearchComponent5, SearchComponent4);

            ISearchComponentFactory serviceFactory6  = new SearchComponentFactory();
            ISearchComponent        SearchComponent6 = serviceFactory.CreateSearchComponent(DataSources.Flicker);

            Assert.IsTrue(SearchComponent6 is FlickerSearchSearchComponent);
            Assert.AreSame(SearchComponent, SearchComponent6);
        }
        public async Task Test_FlickerSearchComponent_Exception_Negative()
        {
            ISearchComponentFactory serviceFactory  = new SearchComponentFactory();
            ISearchComponent        SearchComponent = serviceFactory.CreateSearchComponent(DataSources.Flicker);
            IQueryContext           queryContext    = new QueryContext();

            queryContext.ApplicationConfiguration = null;
            queryContext.QueryParam = null;

            IResponseContext rc = await SearchComponent.PerformSearch(queryContext);
        }
Пример #3
0
 public static ICachingSearchComponent <string, TSearchResult> Wrap <TSearchResult>(this ISearchComponent <string, TSearchResult> service, int maxCount)
 {
     return(new CachingSearchService <string, TSearchResult>(service, maxCount));
 }
Пример #4
0
 public static ICachingSearchComponent <TSearchQuery, TSearchResult> Wrap <TSearchQuery, TSearchResult>(this ISearchComponent <TSearchQuery, TSearchResult> service, int maxCount)
     where TSearchQuery : ICacheKey
 {
     return(new CachingSearchService <TSearchQuery, TSearchResult>(service, maxCount));
 }
Пример #5
0
 internal CompositeSearchService(ICatalogDb <TId, TFilterQuery, TData> catalog, ISearchComponent <TSearchQuery, TSearchResult> search)
 {
     _catalog = catalog;
     _search  = search;
 }