Пример #1
0
        public void ExecutePathSolver()
        {
            PathNode[,] graph = CreateNodeGraph(10, 10);

            PathSolver  solver = new PathSolver();
            AStarResult result = solver.Solve(graph[2, 2], graph[8, 8]);

            Assert.AreEqual(true, result.IsSuccess);
            Assert.AreEqual(graph[8, 8], result.Result.Last.Value);
        }
Пример #2
0
        public void ExecutePathSolver_Unsolvable()
        {
            PathNode[,] graph = CreateNodeGraph(10, 10);

            for (int i = 0; i < 10; ++i)
            {
                graph[5, i].Connections = new Interfaces.IAStarNodeConnection[0];
            }

            PathSolver  solver = new PathSolver();
            AStarResult result = solver.Solve(graph[2, 2], graph[8, 8]);

            Assert.AreEqual(false, result.IsSuccess);
            Assert.AreEqual(graph[5, 8], result.Result.Last.Value);
        }