public void ExtTest() { var obj = new { state = 0, msg = "ddddd", data = new { test = "111", tds = "dsss" } }; var timer01 = CodeTimer.Time("normal", 20 * 10000, () => { var str = new JavaScriptSerializer().Serialize(obj); }); var timer02 = CodeTimer.Time("ext", 20 * 10000, () => { var str = obj.ToJson(); }); Console.WriteLine(timer01.ToString()); Console.WriteLine(timer02.ToString()); }
public void ShouldImportProperties() { var obj = new { IsSystem = true, BlockTypeId = 1, Zone = "TestZone", Order = 3, Name = "FooInstance", OutputCacheDuration = 0 }; var json = obj.ToJson(); var block = Block.FromJson( json ); Assert.AreEqual( obj.Name, block.Name ); Assert.AreEqual( obj.IsSystem, block.IsSystem ); }
public void ShouldImportBlockType() { var obj = new { IsSystem = true, BlockTypeId = 1, Zone = "TestZone", Order = 3, Name = "FooInstance", OutputCacheDuration = 0, BlockType = new { IsSystem = false, Path = "Test Path", Name = "Test Name", Description = "Test desc" } }; var json = obj.ToJson(); var block = Block.FromJson( json ); var blockType = block.BlockType; Assert.IsNotNull( blockType ); Assert.AreEqual( blockType.Name, obj.BlockType.Name ); }