private static void AssertAttributeAdded(Action<ISubGraphExpression> action, Type attributeType, object attributeValue, Action<ISubGraph> customAsserts) { var graph = new DirectedGraph(); var expression = new SubGraphExpression(graph); action(expression); var cluster = expression.SubGraph; Assert.AreEqual(cluster.Attributes.CurrentAttributes.Count, 1); var attribute = cluster.Attributes.CurrentAttributes[0]; Assert.IsInstanceOfType(attributeType, attribute); Assert.AreEqual(attribute.Value, attributeValue); if (customAsserts != null) { customAsserts(expression.SubGraph); } }
/// <summary> /// Adds a subgraph with the specified name to the graph. /// </summary> /// <param name="name">The name of the subgraph to create.</param> /// <returns> /// A subgraph expression for configuring the graph. /// </returns> public ISubGraphExpression WithName(string name) { var expression = new SubGraphExpression(graph); expression.SubGraph.Name = name; graph.AddSubGraph(expression.SubGraph); return expression; }