示例#1
0
        private ISearchResultRepository <T> CreateSearchResultRepository <T>()
            where T : IndexableEntity, new()
        {
            var elementProvider = new SitecoreSearchQueryElementProvider(() => RenderingContext.Current.Rendering.Item);
            var valueProvider   = new NameValuePairSearchQueryValueProvider(() => Request.QueryString);

            var builder = new SearchResultRepositoryBuilder <T>()
                          .WithIndexNameProvider <SitecoreMasterOrWebIndexNameProvider>();

            return(builder.Create(elementProvider, valueProvider));
        }
示例#2
0
        public void Create_UsingDefaultSettings_ReturnsSearchQueryRepositoryUsingSitecoreMasterOrWebIndexNameProviderAndDefaultPredicateBuilder(
            ISearchQueryElementProvider elementProvider,
            ISearchQueryValueProvider valueProvider)
        {
            // Arrange
            var sut = new SearchResultRepositoryBuilder <TestIndexableEntity>();

            // Act
            var actual = sut.Create(elementProvider, valueProvider);

            // Assert
            actual.IndexNameProvider.Should().BeOfType <SitecoreMasterOrWebIndexNameProvider>();
            actual.SearchQueryPredicateBuilder.Should().BeOfType <SearchQueryPredicateBuilder <TestIndexableEntity> >();
        }