public void SerializeToString () { var obj = new TestObject (); var json = context.CakeContext.SerializeJson (obj); Assert.IsNotEmpty (json); Assert.AreEqual (SERIALIZED_JSON, json); }
public void SerializeToStringWithIndentation() { var obj = new TestObject (); var json = context.CakeContext.SerializeJson (obj, Formatting.Indented); Assert.IsNotEmpty (json); Assert.AreEqual (SERIALIZED_JSON_INDENTED, json); }
public void SerializeToFile () { var obj = new TestObject (); var file = new FilePath ("./serialized.json"); context.CakeContext.SerializeJsonToFile (file, obj); var json = System.IO.File.ReadAllText (file.MakeAbsolute (context.CakeContext.Environment).FullPath); Assert.IsNotEmpty (json); Assert.AreEqual (SERIALIZED_JSON, json); }