public void CreateConnection_Connection_Succeed() { //arrange GraphSystem graphSystem = new GraphSystem(); graphSystem.Create <ExampleNode>(NodeCreationInfo.Empty); graphSystem.Create <ExampleNode>(NodeCreationInfo.Empty); Node node1 = graphSystem.graph.Nodes[0]; Node node2 = graphSystem.graph.Nodes[1]; Connection connection = new ExampleConnection(); //act graphSystem.graph.AddConnection(node1, node2, connection); //assert Assert.AreEqual(connection, graphSystem.graph.GetDirectedConnection(node1, node2)); }
public void GenerateNode_ExampleNode_Succeed() { //arrange GraphSystem graphSystem = new GraphSystem(); //act graphSystem.Create <ExampleNode>(NodeCreationInfo.Empty); //assert Assert.AreEqual(1, graphSystem.graph.Nodes.Count); }
public void GetConnections_ConnectionList_Success() { //arrange GraphSystem graphSystem = new GraphSystem(); graphSystem.Create <ExampleNode>(NodeCreationInfo.Empty); graphSystem.Create <ExampleNode>(NodeCreationInfo.Empty); graphSystem.Create <ExampleNode>(NodeCreationInfo.Empty); graphSystem.Create <ExampleNode>(NodeCreationInfo.Empty); graphSystem.Create <ExampleNode>(NodeCreationInfo.Empty); Node node1 = graphSystem.graph.Nodes[0]; Node node2 = graphSystem.graph.Nodes[1]; Node node3 = graphSystem.graph.Nodes[2]; Node node4 = graphSystem.graph.Nodes[3]; Node node5 = graphSystem.graph.Nodes[4]; Connection c1, c2, c3, c4; c1 = new ExampleConnection(); c2 = new ExampleConnection(); c3 = new ExampleConnection(); c4 = new ExampleConnection(); graphSystem.graph.AddConnection(node1, node2, c1); graphSystem.graph.AddConnection(node1, node3, c2); graphSystem.graph.AddConnection(node1, node4, c3); graphSystem.graph.AddConnection(node1, node5, c4); //act List <(Connection, Node)> connectionList = new List <(Connection, Node)>(); connectionList.Add((c1, node2)); connectionList.Add((c2, node3)); connectionList.Add((c3, node4)); connectionList.Add((c4, node5)); List <(Connection, Node)> getConnectionsList = graphSystem.graph.GetOutgoingConnections(node1); //assert CollectionAssert.AreEquivalent(connectionList, getConnectionsList); }