Пример #1
0
 public void PASS_CreateQuery()
 {
     MatchQuery query = new MatchQuery("field1", "value1");
     Assert.IsNotNull(query);
     Assert.AreEqual("field1", query.Field);
     Assert.AreEqual("value1", query.Query);
 }
Пример #2
0
        public void PASS_Serialize()
        {
            MatchQuery query = new MatchQuery("field1", "value1");
            string json = JsonConvert.SerializeObject(query);

            Assert.IsNotNull(json);

            string expectedJson = "{\"match\":{\"field1\":\"value1\"}}";
            Assert.AreEqual(expectedJson, json);
        }
Пример #3
0
 public void FAIL_CreateQuery_Query()
 {
     try
     {
         MatchQuery query = new MatchQuery("field1", null);
         Assert.Fail();
     }
     catch (ArgumentNullException argEx)
     {
         Assert.AreEqual("query", argEx.ParamName);
     }
 }
Пример #4
0
 public void FAIL_CreateQuery_Field()
 {
     try
     {
         MatchQuery query = new MatchQuery(null, "value1");
         Assert.Fail();
     }
     catch (ArgumentNullException argEx)
     {
         Assert.AreEqual("field", argEx.ParamName);
     }
 }