public void AddEdge_ShouldSaveEdgeInfo() { var node1 = graph.AddNode(); var node2 = graph.AddNode(); var edge12 = graph.AddEdge(node1, node2, 42, Color.Red); graph.EdgeInfos[edge12] .Should() .Be(new EdgeInfo(graph.NodeInfos[node1], graph.NodeInfos[node2], Color.Red)); }
private void imDrawSpace_MouseUp(object sender, MouseEventArgs e) { if (nodesEdgesState == NodesEdges.Nodes) { switch (clickState) { case ClickStates.Add: clickedNode = graph.AddNode(x, y, Color.White); break; case ClickStates.Delete: if (clickedNode != null) { graph.DeleteNode(clickedNode); } break; case ClickStates.Move: break; } } else { switch (clickState) { case ClickStates.Add: if (selectedNode != null && selectedNode != clickedNode) { IEdge edge = graph.AddEdge(clickedNode, selectedNode, DefaultLength); } break; case ClickStates.Delete: graph.DeleteEdge(clickedEdge); break; } } clickedNode = null; clickedEdge = null; clickState = ClickStates.NoClick; draw(); }