public void ClearAdjacencyGraph_InvalidatesOldNodes() { var solver = new PathSolver <Point, PathTestOption>(_testMap); // Build a graph based on all three points. solver.BuildAdjacencyGraph(new Point[] { _startPt, _reachableEndPt, _unreachableEndPt }); // Clear the graph, and then rebuild it with just one point. solver.ClearAdjacencyGraph(); solver.BuildAdjacencyGraph(_startPt); // Try to find a path to _unreachableEndPt. PathSolver should complain that it doesn't know about that point. PathResult <Point> pathResult = null; Assert.ThrowsException <PathfindingException>(() => pathResult = solver.FindPath(_startPt, _unreachableEndPt, PathTestOption.Normal)); }