public void TestMultipleNestedStruct() { var obj = new SimpleClassWithNestedStruct(1.0, "test", 5.0, "inner value"); Assert.That(obj.Struct.FirstValue, Is.EqualTo(1.0)); Assert.That(obj.Struct.SecondValue, Is.EqualTo("test")); Assert.That(obj.Struct.InnerStruct.FirstValue, Is.EqualTo(5.0)); Assert.That(obj.Struct.InnerStruct.SecondValue, Is.EqualTo("inner value")); var container = new NodeContainer(); IGraphNode model = container.GetOrCreateNode(obj); Console.WriteLine(model.PrintHierarchy()); var structNode = model.GetChild("Struct").Content.Reference.AsObject.TargetNode; structNode.GetChild("FirstValue").Content.Update(2.0); structNode.GetChild("SecondValue").Content.Update("new value"); structNode = structNode.GetChild("InnerStruct").Content.Reference.AsObject.TargetNode; structNode.GetChild("FirstValue").Content.Update(7.0); structNode.GetChild("SecondValue").Content.Update("new inner value"); Assert.That(obj.Struct.FirstValue, Is.EqualTo(2.0)); Assert.That(obj.Struct.SecondValue, Is.EqualTo("new value")); Assert.That(obj.Struct.InnerStruct.FirstValue, Is.EqualTo(7.0)); Assert.That(obj.Struct.InnerStruct.SecondValue, Is.EqualTo("new inner value")); }
public void TestMultipleNestedStruct() { var obj = new SimpleClassWithNestedStruct(1.0, "test", 5.0, "inner value"); Assert.That(obj.Struct.FirstValue, Is.EqualTo(1.0)); Assert.That(obj.Struct.SecondValue, Is.EqualTo("test")); Assert.That(obj.Struct.InnerStruct.FirstValue, Is.EqualTo(5.0)); Assert.That(obj.Struct.InnerStruct.SecondValue, Is.EqualTo("inner value")); var container = new ModelContainer(); IModelNode model = container.GetOrCreateModelNode(obj, obj.GetType()); Console.WriteLine(model.PrintHierarchy()); model.GetChild("Struct").GetChild("FirstValue").Content.Value = 2.0; model.GetChild("Struct").GetChild("SecondValue").Content.Value = "new value"; model.GetChild("Struct").GetChild("InnerStruct").GetChild("FirstValue").Content.Value = 7.0; model.GetChild("Struct").GetChild("InnerStruct").GetChild("SecondValue").Content.Value = "new inner value"; Assert.That(obj.Struct.FirstValue, Is.EqualTo(2.0)); Assert.That(obj.Struct.SecondValue, Is.EqualTo("new value")); Assert.That(obj.Struct.InnerStruct.FirstValue, Is.EqualTo(7.0)); Assert.That(obj.Struct.InnerStruct.SecondValue, Is.EqualTo("new inner value")); }
public void TestMultipleNestedStruct() { var obj = new SimpleClassWithNestedStruct(1.0, "test", 5.0, "inner value"); Assert.That(obj.Struct.FirstValue, Is.EqualTo(1.0)); Assert.That(obj.Struct.SecondValue, Is.EqualTo("test")); Assert.That(obj.Struct.InnerStruct.FirstValue, Is.EqualTo(5.0)); Assert.That(obj.Struct.InnerStruct.SecondValue, Is.EqualTo("inner value")); var container = new NodeContainer(); IGraphNode model = container.GetOrCreateNode(obj); Console.WriteLine(model.PrintHierarchy()); var structNode = model.GetChild("Struct").Content.Reference.AsObject.TargetNode; structNode.GetChild("FirstValue").Content.Update(2.0); structNode.GetChild("SecondValue").Content.Update("new value"); structNode = structNode.GetChild("InnerStruct").Content.Reference.AsObject.TargetNode; structNode.GetChild("FirstValue").Content.Update(7.0); structNode.GetChild("SecondValue").Content.Update("new inner value"); Assert.That(obj.Struct.FirstValue, Is.EqualTo(2.0)); Assert.That(obj.Struct.SecondValue, Is.EqualTo("new value")); Assert.That(obj.Struct.InnerStruct.FirstValue, Is.EqualTo(7.0)); Assert.That(obj.Struct.InnerStruct.SecondValue, Is.EqualTo("new inner value")); }
public void TestMultipleNestedStruct() { var obj = new SimpleClassWithNestedStruct(1.0, "test", 5.0, "inner value"); Assert.That(obj.Struct.FirstValue, Is.EqualTo(1.0)); Assert.That(obj.Struct.SecondValue, Is.EqualTo("test")); Assert.That(obj.Struct.InnerStruct.FirstValue, Is.EqualTo(5.0)); Assert.That(obj.Struct.InnerStruct.SecondValue, Is.EqualTo("inner value")); var container = new ModelContainer(); IModelNode model = container.GetOrCreateModelNode(obj, obj.GetType()); Console.WriteLine(model.PrintHierarchy()); model.GetChild("Struct").GetChild("FirstValue").Content.Value = 2.0; model.GetChild("Struct").GetChild("SecondValue").Content.Value = "new value"; model.GetChild("Struct").GetChild("InnerStruct").GetChild("FirstValue").Content.Value = 7.0; model.GetChild("Struct").GetChild("InnerStruct").GetChild("SecondValue").Content.Value = "new inner value"; Assert.That(obj.Struct.FirstValue, Is.EqualTo(2.0)); Assert.That(obj.Struct.SecondValue, Is.EqualTo("new value")); Assert.That(obj.Struct.InnerStruct.FirstValue, Is.EqualTo(7.0)); Assert.That(obj.Struct.InnerStruct.SecondValue, Is.EqualTo("new inner value")); }