public void SimplePropertyDeserializationTest() { var jsonString = "{\"NestedNode\":{\"Data\":\"test\"}}"; var expectedResult = new PropertyTestModel <string> { Data = "test" }; var result = JsonConvert.DeserializeObject <PropertyTestModel <string> >(jsonString); expectedResult.ShouldDeepEqual(result); }
public void SerializationWithObjectPropertyTest() { var jsonString = "{\"NestedNode\":{\"Data\":{\"name\":\"test\"}}}"; var obj = new PropertyTestModel <ModelWithJsonProperty> { Data = new ModelWithJsonProperty { Name = "test" } }; var result = JsonConvert.SerializeObject(obj); result.ShouldDeepEqual(jsonString); }
public void NestedObjectPropertyDeserializationTest() { var jsonString = "{\"NestedNode\":{\"Data\":{\"name\":\"test\"}}}"; var expectedResult = new PropertyTestModel <ModelWithJsonProperty> { Data = new ModelWithJsonProperty { Name = "test" } }; var result = JsonConvert.DeserializeObject <PropertyTestModel <ModelWithJsonProperty> >(jsonString); expectedResult.ShouldDeepEqual(result); }