public void ConvertToDest() { var c = new JObjectToJsonConverter(); var d = c.ConvertToDest(null); Assert.IsNull(d); d = c.ConvertToDest(JObject.FromObject(new Person { FirstName = "Jen", LastName = "Browne" })); Assert.AreEqual("{\"FirstName\":\"Jen\",\"LastName\":\"Browne\"}", d); }
public void ConvertToSrce() { var c = new JObjectToJsonConverter(); var s = c.ConvertToSrce(null); Assert.IsNull(s); s = c.ConvertToSrce("{\"FirstName\":\"Jen\",\"LastName\":\"Browne\"}"); Assert.IsNotNull(s); var p = s.ToObject <Person>(); Assert.IsNotNull(p); Assert.AreEqual("Jen", p.FirstName); Assert.AreEqual("Browne", p.LastName); }