private static void InitIndexes(ISearchIndex index, SearchProvider searchProvider, IQueryable <SearchResultItem> results) { ContentSearchManager.SearchConfiguration.Indexes.Clear(); searchProvider?.GetContextIndexName(Arg.Any <IIndexable>(), Arg.Any <ICorePipeline>()).Returns("CustomIndexName"); var providerSearchContext = Substitute.For <IProviderSearchContext>(); index.ReturnsForAll(providerSearchContext); providerSearchContext.GetQueryable <SearchResultItem>(Arg.Any <IExecutionContext[]>()).Returns(results); ContentSearchManager.SearchConfiguration.Indexes.Add("CustomIndexName", index); }
private static void InitIndexes(ISearchIndex index, SearchProvider searchProvider, IQueryable<SearchResultItem> results) { ContentSearchManager.SearchConfiguration.Indexes.Clear(); searchProvider?.GetContextIndexName(Arg.Any<IIndexable>(), Arg.Any<ICorePipeline>()).Returns("CustomIndexName"); var providerSearchContext = Substitute.For<IProviderSearchContext>(); index.ReturnsForAll(providerSearchContext); providerSearchContext.GetQueryable<SearchResultItem>(Arg.Any<IExecutionContext[]>()).Returns(results); ContentSearchManager.SearchConfiguration.Indexes.Add("CustomIndexName", index); }