public void PASS_CreateFilter() { StringRangeFilter filter = new StringRangeFilter("field", "1"); Assert.IsNotNull(filter); Assert.AreEqual("field", filter.Field); Assert.AreEqual("1", filter.GreaterThan); }
public void PASS_Serializer() { StringRangeFilter filter = new StringRangeFilter("field", "1"); string json = JsonConvert.SerializeObject(filter); Assert.IsNotNull(json); string expectedJson = "{\"range\":{\"field\":{\"gt\":\"1\"}}}"; Assert.AreEqual(expectedJson, json); }
public void FAIL_CreateFilter_Range() { try { StringRangeFilter filter = new StringRangeFilter("field"); Assert.Fail(); } catch (ArgumentNullException ex) { Assert.AreEqual("range", ex.ParamName); } }
public void PASS_Serialize_Execution_Index() { StringRangeFilter filter = new StringRangeFilter("field", "1") { ExecutionType = ExecutionTypeEnum.Index }; string json = JsonConvert.SerializeObject(filter); Assert.IsNotNull(json); string expectedJson = "{\"range\":{\"field\":{\"gt\":\"1\"},\"execution\":\"index\"}}"; Assert.AreEqual(expectedJson, json); }