Exemplo n.º 1
0
        public void ShouldRespectMovementPattern()
        {
            var grid = GridCatalog.GridWithObstructedDiagonals();
            var path = grid.GetPath(new Position(0, 0), new Position(8, 8), MovementPatterns.LateralOnly, AgentShapes.Dot);

            Assert.NotNull(path);
            Assert.Empty(path);
        }
Exemplo n.º 2
0
        public void NonExistingPathShouldReturnEmtpyArray()
        {
            var grid = GridCatalog.GridWithEnclosedCenterTile();
            var path = grid.GetPath(new Position(0, 0), new Position(4, 4));

            Assert.NotNull(path);
            Assert.Empty(path);
        }
Exemplo n.º 3
0
        public void ShouldRespectIterationLimit()
        {
            var grid = GridCatalog.UnobstructedGrid();
            var path = grid.GetPath(new Position(0, 0), new Position(8, 8), MovementPatterns.Full, AgentShapes.Dot, 8);

            Assert.NotNull(path);
            Assert.Empty(path);
        }
Exemplo n.º 4
0
        public void ShouldFindPathWithNonZeroStartingPosition()
        {
            var grid = GridCatalog.UnobstructedGrid();
            var path = grid.GetPath(new Position(3, 3), new Position(5, 3));

            Assert.NotNull(path);
            Assert.Equal(3, path.Length);
        }
Exemplo n.º 5
0
        public void ShouldFindPathInUnobstructedGrid()
        {
            var grid = GridCatalog.UnobstructedGrid();
            var path = grid.GetPath(new Position(0, 0), new Position(8, 8));

            Assert.NotNull(path);
            Assert.Equal(9, path.Length);
        }
Exemplo n.º 6
0
        public void ShouldRespectCellCost()
        {
            var grid = GridCatalog.GridWithHighCostCenterTile();
            var path = grid.GetPath(new Position(0, 0), new Position(8, 8));

            Assert.NotNull(path);
            Assert.DoesNotContain(new Position(4, 4), path);
            Assert.Equal(10, path.Length);
        }
Exemplo n.º 7
0
        public void ShouldRespectBlockedCells()
        {
            var grid   = GridCatalog.GridWithBlockedCenterTile();
            var result = grid.TryGetPath(new Position(0, 0), new Position(8, 8), out Position[] path);

            Assert.NotNull(path);
            Assert.DoesNotContain(new Position(4, 4), path);
            Assert.Equal(10, path.Length);
        }