Beispiel #1
0
        public void ConstructingSuggestQueryWithoutValidHostShouldThrowException()
        {
            var q = new SuggestionQuery();

            Assert.Throws<ArgumentException>(() => q.ConstructQuery());
        }
Beispiel #2
0
        public void ConstructingSuggestQueryWithoutSpecifyingAnyParametersShouldYieldCorrectQuery()
        {
            var q = new SuggestionQuery();
            q.GsaHostAddress = SuggestHost;

            StringAssert.AreEqualIgnoringCase("http://google04.domain.se/suggest/?q=&format=rich", q.ConstructQuery());
        }
Beispiel #3
0
        public void ConstructingSuggestQueryWithMaxSuggestionsShouldYieldCorrectQuery()
        {
            var q = new SuggestionQuery();
            q.GsaHostAddress = SuggestHost;
            q.MaxSuggestions = 7;

            StringAssert.Contains("&max=7", q.ConstructQuery());
        }
Beispiel #4
0
        public void ConstructingSuggestQueryWithCollectionsShouldYieldCorrectQuery()
        {
            var q = new SuggestionQuery();
            q.GsaHostAddress = SuggestHost;
            q.Collections = "col";

            StringAssert.Contains("&site=col", q.ConstructQuery());
        }
Beispiel #5
0
        public void ConstructingSuggestQueryWithClientShouldYieldCorrectQuery()
        {
            var q = new SuggestionQuery();
            q.GsaHostAddress = SuggestHost;
            q.Client = "client";

            StringAssert.Contains("&client=client", q.ConstructQuery());
        }
Beispiel #6
0
        public void ConstructingSuggestQueryWithAccessShouldYieldCorrectQuery()
        {
            var q = new SuggestionQuery();
            q.GsaHostAddress = SuggestHost;
            q.Access = SearchAccess.Public;
            q.SearchTerm = "apa";

            StringAssert.Contains("?q=apa", q.ConstructQuery());
            StringAssert.Contains("&access=p", q.ConstructQuery());

            q.Access = SearchAccess.Secure;
            StringAssert.Contains("&access=s", q.ConstructQuery());

            q.Access = SearchAccess.All;
            StringAssert.Contains("&access=a", q.ConstructQuery());

            q.Access = SearchAccess.Ignore;
            StringAssert.DoesNotContain("&access=", q.ConstructQuery());
        }