コード例 #1
0
ファイル: Test.cs プロジェクト: Redth/Cake.Json
        public void SerializeToString ()
        {
            var obj = new TestObject ();

            var json = context.CakeContext.SerializeJson (obj);

            Assert.IsNotEmpty (json);
            Assert.AreEqual (SERIALIZED_JSON, json);
        }
コード例 #2
0
ファイル: Test.cs プロジェクト: tlycken/Cake.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);
        }
コード例 #3
0
ファイル: Test.cs プロジェクト: Redth/Cake.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);
        }