public void SetTargetVertex() { var graph = new BidirectionalGraph <int, Edge <int> >(); var algorithm = new HoffmanPavleyRankedShortestPathAlgorithm <int, Edge <int> >(graph, e => 1.0); const int vertex1 = 0; algorithm.SetTargetVertex(vertex1); algorithm.TryGetTargetVertex(out int target); Assert.AreEqual(vertex1, target); // Not changed algorithm.SetTargetVertex(vertex1); algorithm.TryGetTargetVertex(out target); Assert.AreEqual(vertex1, target); const int vertex2 = 1; algorithm.SetTargetVertex(vertex2); algorithm.TryGetTargetVertex(out target); Assert.AreEqual(vertex2, target); }
public void TryGetTargetVertex() { var graph = new BidirectionalGraph <int, Edge <int> >(); var algorithm = new HoffmanPavleyRankedShortestPathAlgorithm <int, Edge <int> >(graph, e => 1.0); Assert.IsFalse(algorithm.TryGetTargetVertex(out _)); const int vertex = 0; algorithm.SetTargetVertex(vertex); Assert.IsTrue(algorithm.TryGetTargetVertex(out int target)); AssertEqual(vertex, target); }