Ejemplo n.º 1
0
 public void Setup()
 {
     tree = new StringIntTree(new StringIntNode(), "root");
     tree.Root.AddChildren(
         new[]
     {
         tree.CreateNode <StringIntNode>("N1",
                                         new Dictionary <string, int>()
         {
             { "propN1_1", 11 },
             { "propN1_2", 12 },
             { "override", 1 },
             { "changing", 0 },
         },
                                         tree.CreateNode <StringIntNode>("N11",
                                                                         new Dictionary <string, int>()
         {
             { "propN2_1", 21 },
             { "propN2_2", 22 },
             { "override", 2 },
         }
                                                                         )
                                         )
     }
         );
 }
Ejemplo n.º 2
0
        public void Serialization()
        {
            var raw = tree.ToRawNodes();

            var jsonSerializerSettings = new JsonSerializerSettings()
            {
                TypeNameHandling = TypeNameHandling.All
            };
            string json = Newtonsoft.Json.JsonConvert.SerializeObject(raw, jsonSerializerSettings);

            raw = Newtonsoft.Json.JsonConvert.DeserializeObject <RawNode <StringIntNode, String, int> >(json);

            tree = new StringIntTree(raw);

            this.Defines();
            this.DefinesFalse();
            this.DefinesTrue();
        }