/// <summary> /// Tests the validity of a node that is a member of an object. /// </summary> /// <param name="containerNode">The node of the container of this member.</param> /// <param name="memberNode">The memeber node to validate.</param> /// <param name="container">The value represented by the container node.</param> /// <param name="member">The value of the member represented by the member node.</param> /// <param name="memberName">The name of the member to validate.</param> /// <param name="isReference">Indicate whether the member node is expected to contain a reference to the value it represents.</param> public static void TestMemberNode(IGraphNode containerNode, IGraphNode memberNode, object container, object member, string memberName, bool isReference) { if (containerNode == null) { throw new ArgumentNullException(nameof(containerNode)); } if (memberNode == null) { throw new ArgumentNullException(nameof(memberNode)); } if (container == null) { throw new ArgumentNullException(nameof(container)); } // Check that the content is of the expected type. Assert.Equal(typeof(MemberNode), memberNode.GetType()); // A node with a MemberNode should have the same name that the member in the container. Assert.Equal(memberName, ((IMemberNode)memberNode).Name); // A node with a MemberNode should have its container as parent. Assert.Equal(containerNode, ((IMemberNode)memberNode).Parent); // A node with a MemberNode should have the member value as value of its content. Assert.Equal(member, memberNode.Retrieve()); // A node with a primitive MemberNode should not contain a reference. Assert.Equal(isReference, memberNode.IsReference); }
private static void ProcessChildRanking(IGraphNode node, IGraphNode listener, NodeMetadata metadata, StringBuilder result) { if (listener.GetType().GetGenericTypeDefinition() == typeof(CollectorPipe <>)) { var listenerUniqueName = metadata.GetQuotedUniqueName(listener); result.AppendLine($@"{{ rank=same; {metadata.GetQuotedUniqueName(node)}, {listenerUniqueName}}}"); } }
private static string FormatHelpMessage(IGraphNode node) { return($@" Cannot find node. Type: '{node.GetType()}' Name: '{node.Name}' Most likely you need to Verify() at a node that is a descendent of all inputs. For example, if you are using a JoinedPipes, verify the join node.".Trim()); }