public void GetEdge_With_Ignore_Direction_Param_Throws_When_Invalid_Type_Passed_In_For_Source_Node() { var net = new BasicAdjList(Guid.NewGuid()); INode nodeA = new DummyBasicNode(); INode nodeB = net.CreateNode(); var ex = Assert.Throws<ArgumentException>(() => net.GetEdge(nodeA, nodeB, true)); }
public void GetEdge_With_Ignore_Direction_Param_Throws_When_NullPassed_In_For_Source_Node() { //Arrange var net = new BasicAdjList(Guid.NewGuid()); INode nodeA = null; INode nodeB = net.CreateNode(); var ex = Assert.Throws<ArgumentNullException>(() => net.GetEdge(nodeA, nodeB, true)); }
public void GetEdge_With_Ignore_Direction_Param_ReturnsEdge(bool ignoreDirection) { //Arrange var net = new BasicAdjList(Guid.NewGuid()); INode nodeA = net.CreateNode(); INode nodeB = net.CreateNode(); IEdge edge0 = net.CreateEdge(nodeA, nodeB); IEdge result = net.GetEdge(nodeA, nodeB, ignoreDirection); Assert.NotNull(result); Assert.Same(result, edge0); Assert.Same(nodeA, edge0.SourceNode); Assert.Same(nodeB, edge0.DestinationNode); }
public void GetEdge_With_Ignore_Direction_Param_Returns_Null_If_EdgeDNE(bool ignoreDirection) { //Arrange var net = new BasicAdjList(Guid.NewGuid()); INode nodeA = net.CreateNode(); INode nodeB = net.CreateNode(); INode nodeC = net.CreateNode(); IEdge edge = net.CreateEdge(nodeA, nodeB); IEdge result = net.GetEdge(nodeC, nodeA, ignoreDirection); Assert.Null(result); }
public void GetEdge_With_Ignore_Direction_Param_If_Nodes_AreReversed(bool ignoreDirection, bool nullExpected) { //Arrange var net = new BasicAdjList(Guid.NewGuid()); INode nodeA = net.CreateNode(); INode nodeB = net.CreateNode(); IEdge edge = net.CreateEdge(nodeA, nodeB); IEdge result = net.GetEdge(nodeB, nodeA, ignoreDirection); if (nullExpected) { Assert.Null(result); } else { Assert.NotNull(result); Assert.Same(result, edge); } }
public void GetEdge_Throws_When_Null_Passed_In_For_Souce_Node() { var net = new BasicAdjList(Guid.NewGuid()); INode nodeA = null; INode nodeB = net.CreateNode(); var ex = Assert.Throws<ArgumentNullException>(() => net.GetEdge(nodeA, nodeB)); }
public void GetEdge_Throws_When_Invalid_Type_Passed_In_For_Dest_Node() { var net = new BasicAdjList(Guid.NewGuid()); INode nodeA = net.CreateNode(); INode nodeB = new DummyBasicNode(); var ex = Assert.Throws<ArgumentException>(() => net.GetEdge(nodeA, nodeB)); }
public void GetEdge_Returns_Null_If_Nodes_Are_Reversed_But_Edge_Exists() { //Arrange var net = new BasicAdjList(Guid.NewGuid()); INode nodeA = net.CreateNode(); INode nodeB = net.CreateNode(); IEdge edge = net.CreateEdge(nodeA, nodeB); IEdge result = net.GetEdge(nodeB, nodeA); Assert.Null(result); }
public void GetEdge_Returns_Null_If_Edge_DNE() { //Arrange var net = new BasicAdjList(Guid.NewGuid()); INode nodeA = net.CreateNode(); INode nodeB = net.CreateNode(); INode nodeC = net.CreateNode(); IEdge edge = net.CreateEdge(nodeA, nodeB); IEdge result = net.GetEdge(nodeC, nodeA); Assert.Null(result); }