Ejemplo n.º 1
0
        public void TestDoubleReferenceMemberDataUpdate()
        {
            var doubleRef = new DoubleReferenceClass(new SimpleObject());
            var container = new NodeContainer();
            IGraphNode model = container.GetOrCreateNode(doubleRef);

            doubleRef.Object1.Name = "New Name";

            Assert.That(doubleRef.Object1.Name, Is.EqualTo("New Name"));
            Assert.That(doubleRef.Object2.Name, Is.EqualTo("New Name"));
            var object1TargetNode = ((ObjectReference)model.GetChild("Object1").Content.Reference).TargetNode;
            var object2TargetNode = ((ObjectReference)model.GetChild("Object2").Content.Reference).TargetNode;
            Assert.That(object1TargetNode.GetChild("Name").Content.Value, Is.EqualTo("New Name"));
            Assert.That(object2TargetNode.GetChild("Name").Content.Value, Is.EqualTo("New Name"));
        }
Ejemplo n.º 2
0
        public void TestDoubleReferenceMemberDataUpdate()
        {
            var        doubleRef = new DoubleReferenceClass(new SimpleObject());
            var        container = new ModelContainer();
            IModelNode model     = container.GetOrCreateModelNode(doubleRef, doubleRef.GetType());

            doubleRef.Object1.Name = "New Name";

            Assert.That(doubleRef.Object1.Name, Is.EqualTo("New Name"));
            Assert.That(doubleRef.Object2.Name, Is.EqualTo("New Name"));
            var object1TargetNode = ((ObjectReference)model.GetChild("Object1").Content.Reference).TargetNode;
            var object2TargetNode = ((ObjectReference)model.GetChild("Object2").Content.Reference).TargetNode;

            Assert.That(object1TargetNode.GetChild("Name").Content.Value, Is.EqualTo("New Name"));
            Assert.That(object2TargetNode.GetChild("Name").Content.Value, Is.EqualTo("New Name"));
        }
Ejemplo n.º 3
0
        public void TestDoubleReferenceMemberQuantumUpdate()
        {
            var        doubleRef = new DoubleReferenceClass(new SimpleObject());
            var        container = new NodeContainer();
            IGraphNode model     = container.GetOrCreateNode(doubleRef);

            ((ObjectReference)model.GetChild("Object1").Content.Reference).TargetNode.GetChild("Name").Content.Update("New Name");

            Assert.That(doubleRef.Object1.Name, Is.EqualTo("New Name"));
            Assert.That(doubleRef.Object2.Name, Is.EqualTo("New Name"));
            var object1TargetNode = ((ObjectReference)model.GetChild("Object1").Content.Reference).TargetNode;
            var object2TargetNode = ((ObjectReference)model.GetChild("Object2").Content.Reference).TargetNode;

            Assert.That(object1TargetNode.GetChild("Name").Content.Value, Is.EqualTo("New Name"));
            Assert.That(object2TargetNode.GetChild("Name").Content.Value, Is.EqualTo("New Name"));
        }
Ejemplo n.º 4
0
        public void TestDoubleReferenceAtConstruction()
        {
            var doubleRef = new DoubleReferenceClass(new SimpleObject());
            var container = new NodeContainer();
            IGraphNode model = container.GetOrCreateNode(doubleRef);
            Assert.That(doubleRef.Object1, Is.EqualTo(doubleRef.Object2));
            Assert.That(model.GetChild("Object1").Content.Value, Is.EqualTo(doubleRef.Object1));
            Assert.That(model.GetChild("Object2").Content.Value, Is.EqualTo(doubleRef.Object2));

            Assert.That(model.GetChild("Object1").Content.IsReference, Is.True);
            Assert.That(model.GetChild("Object2").Content.IsReference, Is.True);

            var object1TargetNode = ((ObjectReference)model.GetChild("Object1").Content.Reference).TargetNode;
            var object2TargetNode = ((ObjectReference)model.GetChild("Object2").Content.Reference).TargetNode;
            Assert.That(object1TargetNode, Is.EqualTo(object2TargetNode));
            Assert.That(object1TargetNode.Content.Value, Is.EqualTo(doubleRef.Object1));
        }
Ejemplo n.º 5
0
        public void TestDoubleReferenceAtConstruction()
        {
            var        doubleRef = new DoubleReferenceClass(new SimpleObject());
            var        container = new ModelContainer();
            IModelNode model     = container.GetOrCreateModelNode(doubleRef, doubleRef.GetType());

            Assert.That(doubleRef.Object1, Is.EqualTo(doubleRef.Object2));
            Assert.That(model.GetChild("Object1").Content.Value, Is.EqualTo(doubleRef.Object1));
            Assert.That(model.GetChild("Object2").Content.Value, Is.EqualTo(doubleRef.Object2));

            Assert.That(model.GetChild("Object1").Content.IsReference, Is.True);
            Assert.That(model.GetChild("Object2").Content.IsReference, Is.True);

            var object1TargetNode = ((ObjectReference)model.GetChild("Object1").Content.Reference).TargetNode;
            var object2TargetNode = ((ObjectReference)model.GetChild("Object2").Content.Reference).TargetNode;

            Assert.That(object1TargetNode, Is.EqualTo(object2TargetNode));
            Assert.That(object1TargetNode.Content.Value, Is.EqualTo(doubleRef.Object1));
        }