コード例 #1
0
        public void DocumentSearchFact002()
        {
            // Arrange
            var solrExpressOptions = new SolrExpressOptions
            {
                CheckAnyParameter = false
            };
            var serviceProvider      = new Mock <ISolrExpressServiceProvider <TestDocument> >();
            var searchItemCollection = new Mock <ISearchItemCollection <TestDocument> >();

            var documentSearch = new DocumentSearch <TestDocument>(
                solrExpressOptions,
                serviceProvider.Object,
                searchItemCollection.Object);

            var parameter = new FakeParameter
            {
                Name = "q"
            };

            // Act / Assert
            documentSearch.ValidateSearchItem(parameter);
        }
コード例 #2
0
        public void DocumentSearchFact001()
        {
            // Arrange
            var solrExpressOptions = new SolrExpressOptions
            {
                CheckAnyParameter = true
            };
            var serviceProvider      = new Mock <ISolrExpressServiceProvider <TestDocument> >();
            var searchItemCollection = new Mock <ISearchItemCollection <TestDocument> >();

            var documentSearch = new DocumentSearch <TestDocument>(
                solrExpressOptions,
                serviceProvider.Object,
                searchItemCollection.Object);

            var parameter = new FakeParameter
            {
                Name = "q"
            };

            // Act / Assert
            Assert.Throws <SearchParameterIsInvalidException>(() => documentSearch.ValidateSearchItem(parameter));
        }