public void PASS_Serialize_IncludField() { SourceFilter source = new SourceFilter("field"); string json = JsonConvert.SerializeObject(source); Assert.IsNotNull(json); string expectedJson = "\"field\""; Assert.AreEqual(expectedJson, json); }
public void PASS_Serialize() { SourceFilter source = new SourceFilter(); string json = JsonConvert.SerializeObject(source); Assert.IsNotNull(json); string expectedJson = "false"; Assert.AreEqual(expectedJson, json); }
public void FAIL_Create_ExcludeFields() { try { SourceFilter source = new SourceFilter(new List<string>() { "field1" }, null); Assert.Fail(); } catch (ArgumentNullException ex) { Assert.AreEqual("excludeFields", ex.ParamName); } }
public void FAIL_Create_IncludeField() { try { SourceFilter source = new SourceFilter((string)null); Assert.Fail(); } catch(ArgumentNullException ex) { Assert.AreEqual("includeField", ex.ParamName); } }
public void PASS_Create() { SourceFilter source = new SourceFilter(); Assert.IsNotNull(source); Assert.AreEqual(true, source.DisableSourceRetrieval); }
public void PASS_Serialize_ExcludeFields() { SourceFilter source = new SourceFilter( new List<string>() { "field1", "field2" }, new List<string>() { "field3", "field4" }); string json = JsonConvert.SerializeObject(source); Assert.IsNotNull(json); string expectedJson = "{\"include\":[\"field1\",\"field2\"],\"exclude\":[\"field3\",\"field4\"]}"; Assert.AreEqual(expectedJson, json); }