public void ConstructingSuggestQueryWithoutValidHostShouldThrowException() { var q = new SuggestionQuery(); Assert.Throws<ArgumentException>(() => q.ConstructQuery()); }
public void ConstructingSuggestQueryWithoutSpecifyingAnyParametersShouldYieldCorrectQuery() { var q = new SuggestionQuery(); q.GsaHostAddress = SuggestHost; StringAssert.AreEqualIgnoringCase("http://google04.domain.se/suggest/?q=&format=rich", q.ConstructQuery()); }
public void ConstructingSuggestQueryWithMaxSuggestionsShouldYieldCorrectQuery() { var q = new SuggestionQuery(); q.GsaHostAddress = SuggestHost; q.MaxSuggestions = 7; StringAssert.Contains("&max=7", q.ConstructQuery()); }
public void ConstructingSuggestQueryWithCollectionsShouldYieldCorrectQuery() { var q = new SuggestionQuery(); q.GsaHostAddress = SuggestHost; q.Collections = "col"; StringAssert.Contains("&site=col", q.ConstructQuery()); }
public void ConstructingSuggestQueryWithClientShouldYieldCorrectQuery() { var q = new SuggestionQuery(); q.GsaHostAddress = SuggestHost; q.Client = "client"; StringAssert.Contains("&client=client", q.ConstructQuery()); }
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()); }