public Export ( ) : Newtonsoft.Json.Linq.JObject | ||
Résultat | Newtonsoft.Json.Linq.JObject |
public override JObject Export()
{
var json = base.Export();
json.Add(new JProperty("regexp", _regex));
if (!string.IsNullOrEmpty(_field))
{
json.Add(new JProperty("field", _field));
}
return json;
}
}
public void Export_Omits_Field_If_Not_Provided() { var query = new RegexpQuery("regex"); var expected = JsonConvert.SerializeObject(new { regexp = "regex" }, Formatting.None); Assert.AreEqual(expected, query.Export().ToString(Formatting.None)); }