public void TestToDataType() { JSONTestObject test = new JSONTestObject() { field1 = "Testset", field2 = 4, field3 = false }; IRestDataSerializer serializer = new JsonRestDataSerializer(); string expected = "{\"field1\":\"Testset\",\"field2\":4,\"field3\":false}"; Assert.AreEqual <string>(expected, serializer.ToDataType <JSONTestObject>(test)); }
public void TestFromDataType() { string test = "{\"field1\":\"Testset\",\"field2\":4,\"field3\":false}"; JSONTestObject2 expected = new JSONTestObject2() { field1 = "Testset", field2 = 4, field3 = false }; IRestDataSerializer serializer = new JsonRestDataSerializer(); JSONTestObject2 actual = serializer.FromDataType <JSONTestObject2>(test); Assert.AreEqual <string>(expected.field1, actual.field1); Assert.AreEqual <int>(expected.field2, actual.field2); Assert.AreEqual <bool>(expected.field3, actual.field3); }