Exemplo n.º 1
0
        public void TestDataContractJsonSerializer()
        {
            var treeitem = new TreeItem <string>();

            treeitem.Id        = "1";
            treeitem.Text      = "Root";
            treeitem.Value     = "3223";
            treeitem.Isexpand  = true;
            treeitem.Showcheck = true;
            treeitem.Add(
                new TreeItem <string>
            {
                Id = "2", Text = "Node2", Value = "9982", Showcheck = true, Isexpand = true, Checkstate = 1
            });

            string mstr = treeitem.ToJsonString2();

            Console.WriteLine(mstr);

            string tstr = treeitem.ToJsonString();

            Console.WriteLine(tstr);

            Assert.Equal(tstr.Length, mstr.Length);
        }
Exemplo n.º 2
0
        public void TestDataContractJsonSerializer()
        {
            var treeitem = new TreeItem<string>();
            treeitem.Id = "1";
            treeitem.Text = "Root";
            treeitem.Value = "3223";
            treeitem.Isexpand = true;
            treeitem.Showcheck = true;
            treeitem.Add(
                new TreeItem<string>
                    {
                       Id = "2", Text = "Node2", Value = "9982", Showcheck = true, Isexpand = true, Checkstate = 1 
                    });

            string mstr = treeitem.ToJsonString2();

            Console.WriteLine(mstr);

            string tstr = treeitem.ToJsonString();
            Console.WriteLine(tstr);

            Assert.Equal(tstr.Length, mstr.Length);
        }