public void PASS_CreateQuery() { MatchPhraseQuery query = new MatchPhraseQuery("field1", "value1"); Assert.IsNotNull(query); Assert.AreEqual("field1", query.Field); Assert.AreEqual("value1", query.Query); }
public void PASS_Serialize() { MatchPhraseQuery query = new MatchPhraseQuery("field1", "value1"); string json = JsonConvert.SerializeObject(query); Assert.IsNotNull(json); string expectedJson = "{\"match_phrase\":{\"field1\":\"value1\"}}"; Assert.AreEqual(expectedJson, json); }
public void FAIL_CreateQuery_Query() { try { MatchPhraseQuery query = new MatchPhraseQuery("field1", null); Assert.Fail(); } catch (ArgumentNullException argEx) { Assert.AreEqual("query", argEx.ParamName); } }
public void FAIL_CreateQuery_Field() { try { MatchPhraseQuery query = new MatchPhraseQuery(null, "value1"); Assert.Fail(); } catch (ArgumentNullException argEx) { Assert.AreEqual("field", argEx.ParamName); } }