public void ConnectSymmetricallyTest() { var a = new PathNode(); var b = new PathNode(); a.ConnectSymmetrically(b); Assert.IsTrue(a.Connections.Contains(b)); Assert.IsTrue(b.Connections.Contains(a)); }
private static PathFindingTestCase ImpossiblePathTestCase() { var a = new PathNode(); var b = new PathNode(); var c = new PathNode(); a.ConnectSymmetrically(b); b.ConnectSymmetrically(c); b.DisconnectAsymmetrically(c); return(new PathFindingTestCase(new PathRequest(a, c), PathfindingState.Failed, null)); }
public static IEnumerable <PathFindingTestCase> EnumerateTestCases() { var pointA = new PathNode { Position = new Vector3(-1, 0, 0) }; var pointB = new PathNode { Position = new Vector3(1, 0, 0) }; var pointC = new PathNode { Position = new Vector3(-2, 0, 4) }; pointA.ConnectSymmetrically(pointB); pointB.ConnectSymmetrically(pointC); yield return(new PathFindingTestCase(new PathRequest(pointA, pointB), PathfindingState.Successful, 2)); yield return(new PathFindingTestCase(new PathRequest(pointA, pointC), PathfindingState.Successful, 7)); yield return(ImpossiblePathTestCase()); }