public void Should_deserialize_using_configured_JsonSerializerSettings() { JsonSerializer <SampleClass> serializer = new JsonSerializer <SampleClass>(StandardSettings); string serialized = "{\"StringProperty\":\"\\u003chtml\\u003e\\u003c/html\\u003e\",\"IntProperty\":1}"; SampleClass deserialized = serializer.Deserialize(serialized); deserialized.ShouldBeEquivalentTo(new { IntProperty = 1, StringProperty = "<html></html>" }); }
public void Should_deserialize_using_configured_JsonSerializerSettings() { Newtonsoft.Json.JsonSerializerSettings settings = new Newtonsoft.Json.JsonSerializerSettings() { StringEscapeHandling = Newtonsoft.Json.StringEscapeHandling.EscapeHtml }; JsonSerializer <SampleClass> serializer = new JsonSerializer <SampleClass>(settings); string serialized = "{\"StringProperty\":\"\\u003chtml\\u003e\\u003c/html\\u003e\",\"IntProperty\":1}"; SampleClass deserialized = serializer.Deserialize(serialized); deserialized.ShouldBeEquivalentTo(new { IntProperty = 1, StringProperty = "<html></html>" }); }