public void Export_With_SearchParams_ReturnsValidJson() { var query = new PhraseQuery("foo").Field("bar"); var searchParams = new SearchParams(); var result = query.Export(searchParams).ToString(Formatting.None); var expected = JsonConvert.SerializeObject(new { ctl = new { timeout = 75000 }, query = new { boost = 0.0, field = "bar", terms = new[] { "foo" } } }, Formatting.None); Assert.AreEqual(expected, result); }
public void Export_Omits_Field_If_Not_Provided() { var query = new PhraseQuery("foo"); var expected = JsonConvert.SerializeObject(new { terms = new[] { "foo" } }, Formatting.None); Assert.Equal(expected, query.Export().ToString(Formatting.None)); }
public void Export_ReturnsValidJson() { var query = new PhraseQuery("foo").Field("bar"); var expected = JsonConvert.SerializeObject(new { terms = new[] { "foo" }, field = "bar", }, Formatting.None); Assert.Equal(expected, query.Export().ToString(Formatting.None)); }
public void Export_ReturnsValidJson() { var query = new PhraseQuery("foo").Field("bar"); var result = query.Export().ToString(Formatting.None); var expected = JsonConvert.SerializeObject(new { query = new { boost = 0.0, field = "bar", terms = new[] { "foo" } } }, Formatting.None); Assert.AreEqual(expected, result); }