Esempio n. 1
0
 public void CreateSimple()
 {
     var instance = new Dummy();
     var node = Node.Create(instance);
     Assert.AreSame(instance, node.Value);
     Assert.AreEqual(4, node.Nodes.Count);
 }
Esempio n. 2
0
 public void DummyListTest()
 {
     var instance = new Dummy { Value = 2, Name = "Max" };
     var l = new List<Dummy>() { instance };
     var node = Node.Create(l);
     Assert.AreEqual(1, node.Nodes.OfType<ItemsNode>().Count());
     var itemNode = node.Nodes.OfType<ItemsNode>()
                             .Single();
     Assert.AreSame(instance, itemNode.Nodes.Single().Value);
 }
Esempio n. 3
0
 public void CreateNested()
 {
     var instance = new Dummy { Next = new Dummy() };
     var node = Node.Create(instance);
     Assert.AreSame(instance, node.Value);
     Assert.AreEqual(4, node.Nodes.Count);
  
     var nextNode = node.Nodes.OfType<IPropertyNode>().Single(x => x.ParentProperty.Name == "Next");
     Assert.AreSame(instance.Next, nextNode.Value);
     Assert.AreEqual(4, nextNode.Nodes.Count);
 }
Esempio n. 4
0
        public void CreateWithValues()
        {
            var instance = new Dummy { Value = 2, Name = "Max" };
            var node = Node.Create(instance);
            var valueNode = node.Nodes.OfType<IPropertyNode>().Single(x => x.ParentProperty.Name == "Value");
            Assert.AreEqual(2, valueNode.Value);

            var nameNode = node.Nodes.OfType<IPropertyNode>().Single(x => x.ParentProperty.Name == "Name");
            Assert.AreEqual("Max", nameNode.Value);

            var nextNode = node.Nodes.OfType<IPropertyNode>().Single(x => x.ParentProperty.Name == "Next");
            Assert.AreEqual(null, nextNode.Value);
        }
Esempio n. 5
0
 public void CollectionWithinClassChangedTest()
 {
     var l = new List<Dummy>() { new Dummy { Value = 1, Name = "Max" } };
     var dummie = new Dummy { Value = 2, Name = "Kalle" };
     var node = Node.Create(dummie);
     var element = node.Nodes.OfType<IPropertyNode>().Single(x => x.ParentProperty.Name == "Dummies");
     Assert.AreEqual(null, element.Value);
     dummie.Dummies = l;
     Assert.AreNotEqual(null, element.Value);
 }