コード例 #1
0
        public void PrettySetsUriQueryWhenNoOtherQueryUriParameters()
        {
            var prettyUri = new SearchRequestFormatter(
                new ElasticConnection(new Uri("http://coruscant.gov/some"), options: new ElasticConnectionOptions { Pretty = true }),
                mapping, new SearchRequest { DocumentType = "type1", Filter = criteria }).Uri;

            Assert.Equal("pretty=true", prettyUri.GetComponents(UriComponents.Query, UriFormat.Unescaped));
        }
コード例 #2
0
        public void PrettyChangesUriQueryParameterWhenDifferentValueAlreadyExists()
        {
            var prettyUri = new SearchRequestFormatter(
                new ElasticConnection(new Uri("http://coruscant.gov/some?pretty=false&human=true"), options: new ElasticConnectionOptions { Pretty = true }),
                mapping, new SearchRequest { DocumentType = "type1", Filter = criteria }).Uri;

            var parameters = prettyUri.GetComponents(UriComponents.Query, UriFormat.Unescaped).Split('&');
            Assert.Equal(2, parameters.Length);
            Assert.Contains("human=true", parameters);
            Assert.Contains("pretty=true", parameters);
        }