public void TestCustomFindTarget() { var nodeContainer = new NodeContainer(); var instance1 = new SimpleClass { Member1 = 3, Member2 = new SimpleClass() }; var instance2 = new SimpleClass { Member1 = 4, Member2 = new SimpleClass() }; var source = nodeContainer.GetOrCreateNode(instance1); var target = nodeContainer.GetOrCreateNode(instance2); var linker = new CustomFindTargetLinker(nodeContainer, source); linker.LinkGraph(source, target); var expectedLinks = new Dictionary <IGraphNode, IGraphNode> { { source, target }, { source.GetChild(nameof(SimpleClass.Member1)), target.GetChild(nameof(SimpleClass.Member1)) }, { source.GetChild(nameof(SimpleClass.Member2)), target.GetChild(nameof(SimpleClass.Member2)) }, { source.GetChild(nameof(SimpleClass.Member2)).GetTarget(), linker.CustomTarget }, { source.GetChild(nameof(SimpleClass.Member2)).GetTarget().GetChild(nameof(SimpleClass.Member1)), linker.CustomTarget.GetChild(nameof(SimpleClass.Member1)) }, { source.GetChild(nameof(SimpleClass.Member2)).GetTarget().GetChild(nameof(SimpleClass.Member2)), linker.CustomTarget.GetChild(nameof(SimpleClass.Member2)) }, }; VerifyLinks(expectedLinks, linker); }
public void TestCustomFindTarget() { var nodeContainer = new NodeContainer(); var instance1 = new SimpleClass { Member1 = 3, Member2 = new SimpleClass() }; var instance2 = new SimpleClass { Member1 = 4, Member2 = new SimpleClass() }; var source = nodeContainer.GetOrCreateNode(instance1); var target = nodeContainer.GetOrCreateNode(instance2); var linker = new CustomFindTargetLinker(nodeContainer, source); linker.LinkGraph(source, target); var expectedLinks = new Dictionary<IGraphNode, IGraphNode> { { source, target }, { source.TryGetChild(nameof(SimpleClass.Member1)), target.TryGetChild(nameof(SimpleClass.Member1)) }, { source.TryGetChild(nameof(SimpleClass.Member2)), target.TryGetChild(nameof(SimpleClass.Member2)) }, { source.TryGetChild(nameof(SimpleClass.Member2)).Target, linker.CustomTarget }, { source.TryGetChild(nameof(SimpleClass.Member2)).Target.TryGetChild(nameof(SimpleClass.Member1)), linker.CustomTarget.TryGetChild(nameof(SimpleClass.Member1)) }, { source.TryGetChild(nameof(SimpleClass.Member2)).Target.TryGetChild(nameof(SimpleClass.Member2)), linker.CustomTarget.TryGetChild(nameof(SimpleClass.Member2)) }, }; VerifyLinks(expectedLinks, linker); }