protected static void InEdge_Test( IMutableBidirectionalGraph <int, Edge <int> > graph) { var edge11 = new Edge <int>(1, 1); var edge13 = new Edge <int>(1, 3); var edge21 = new Edge <int>(2, 1); var edge41 = new Edge <int>(4, 1); graph.AddVerticesAndEdgeRange(new[] { edge11, edge13, edge21, edge41 }); Assert.AreSame(edge11, graph.InEdge(1, 0)); Assert.AreSame(edge41, graph.InEdge(1, 2)); Assert.AreSame(edge13, graph.InEdge(3, 0)); }
protected static void InEdge_Throws_Test( IMutableBidirectionalGraph <int, Edge <int> > graph) { const int vertex1 = 1; const int vertex2 = 2; // ReSharper disable ReturnValueOfPureMethodIsNotUsed Assert.Throws <VertexNotFoundException>(() => graph.InEdge(vertex1, 0)); graph.AddVertex(vertex1); graph.AddVertex(vertex2); AssertIndexOutOfRange(() => graph.InEdge(vertex1, 0)); graph.AddEdge(new Edge <int>(1, 2)); AssertIndexOutOfRange(() => graph.InEdge(vertex1, 5)); // ReSharper restore ReturnValueOfPureMethodIsNotUsed }