public void TestEmptyStructure()
 {
     var upf = new UserProjectFolder("kalle");
     var sb = new StringBuilder();
     upf.ToWidgetTreeString(sb);
     var s = sb.ToString().Replace('\"', '\'');
     Assert.AreEqual("{'label':'kalle','children':[]}", s);
 }
 public void TestSimpleStructure()
 {
     var guid1 = new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
     var guid2 = new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2);
     var upf = new UserProjectFolder("kalle");
     upf.Projects.Add(guid1, "sture");
     upf.Projects.Add(guid2, "nisse");
     var sb = new StringBuilder();
     upf.ToWidgetTreeString(sb);
     var s = sb.ToString().Replace('\"', '\'');
     Assert.AreEqual("{'label':'kalle','children':[{'label':'sture','projid':'00000000-0000-0000-0000-000000000001'},{'label':'nisse','projid':'00000000-0000-0000-0000-000000000002'}]}", s);
 }
        public void TestComplexStructureWithEmptyRoot()
        {
            var guid1 = new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
            var guid2 = new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2);
            var guid3 = new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3);

            var upf = new UserProjectFolder(null);
            upf.Projects.Add(guid1, "sture");
            upf.Projects.Add(guid2, "nisse");

            var upfChild = new UserProjectFolder("urban");
            upfChild.Projects.Add(guid3, "ulrik");
            upf.Folders.Add(upfChild);

            var sb = new StringBuilder();
            upf.ToWidgetTreeString(sb);
            var s = sb.ToString().Replace('\"', '\'');
            Debug.Print(s);
            Assert.AreEqual("[{'label':'urban','children':[{'label':'ulrik','projid':'00000000-0000-0000-0000-000000000003'}]},{'label':'sture','projid':'00000000-0000-0000-0000-000000000001'},{'label':'nisse','projid':'00000000-0000-0000-0000-000000000002'}]", s);
        }