private static void ConvertToGraphMessage(VisualGraphGeneratedMessage message, AffectedGraph graph) { foreach (var node in graph.AllNodes()) { message.Nodes.Add(new GraphNode { Assembly = node.Assembly, DisplayName = node.DisplayName, FullName = node.FullName, IsInterface = node.IsInterface, IsChange = node.IsChange, IsRootNode = node.IsRootNode, IsTest = node.IsTest, Name = node.Name, Type = node.Type, InTestAssembly = node.InTestAssembly, IsProfiledTest = node.Profiled, Complexity = node.Complexity, }); } foreach (var c in graph.AllConnections()) { message.Connections.Add(new Connection { From = c.From, To = c.To }); } }
public void adding_a_null_to_connection_does_not_add_node() { var g = new AffectedGraph(); g.AddConnection("FROM", null, false); Assert.AreEqual(0, g.AllConnections().Count()); }
public void connection_can_be_added_between_same_nodes() { var g = new AffectedGraph(); g.AddNode(new AffectedGraphNode("foo", false, false, false, "name", "bar::foo", "assembly", "type", new List <TestDescriptor>(), false, false, 0)); g.AddConnection("bar::foo", "bar::foo", false); Assert.AreEqual(1, g.AllConnections().Count()); }
public void a_connection_from_a_non_existant_node_does_not_add_connection() { var g = new AffectedGraph(); g.AddNode(new AffectedGraphNode("foo", false, false, false, "name", "bar::foo", "assembly", "type", new List <TestDescriptor>(), false, false, 0)); g.AddConnection("somethingnon-existant", "bar::foo", false); Assert.AreEqual(0, g.AllConnections().Count()); }
public void multiple_connections_can_be_added_between_two_valid_nodes_but_only_one_appears() { var g = new AffectedGraph(); g.AddNode(new AffectedGraphNode("foo", false, false, false, "name", "bar::foo", "assembly", "type", new List <TestDescriptor>(), false, false, 0)); g.AddNode(new AffectedGraphNode("foo", false, false, false, "name", "bar::foo2", "assembly", "type", new List <TestDescriptor>(), false, false, 0)); g.AddConnection("bar::foo2", "bar::foo", false); g.AddConnection("bar::foo2", "bar::foo", false); Assert.AreEqual(1, g.AllConnections().Count()); }
private Dictionary <string, RiskNode> GetHashFrom(AffectedGraph graph) { var ret = new Dictionary <string, RiskNode>(); foreach (var node in graph.AllNodes()) { ret.Add(node.FullName, new RiskNode() { Node = node }); } foreach (var connection in graph.AllConnections()) { RiskNode item; if (!ret.TryGetValue(connection.From, out item)) { ret.Add(connection.From, item); } item.connections.Add(connection.To); } return(ret); }
private static void ConvertToGraphMessage(VisualGraphGeneratedMessage message, AffectedGraph graph) { foreach (var node in graph.AllNodes()) { message.Nodes.Add(new GraphNode { Assembly = node.Assembly, DisplayName = node.DisplayName, FullName = node.FullName, IsInterface = node.IsInterface, IsChange = node.IsChange, IsRootNode = node.IsRootNode, IsTest = node.IsTest, Name = node.Name, Type = node.Type, InTestAssembly = node.InTestAssembly, IsProfiledTest = node.Profiled, Complexity = node.Complexity, }); } foreach (var c in graph.AllConnections()) { message.Connections.Add(new Connection {From = c.From, To = c.To}); } }
public void the_graph_has_four_connections() { Assert.AreEqual(4, _graph.AllConnections().Count()); }