Ejemplo n.º 1
0
        public void ShouldGetSurroundsCase3()
        {
            var map = @"
1Q1 
1 1 
1R1";
            var lab = LabirintParser.Parse(map);

            var surround = lab.GetSurroundCells().ToList();

            var expectedSurrounds = new List <Cell>
            {
                new Cell {
                    CellType = CellType.Wall, Direction = Direction.Left
                },
                new Cell {
                    CellType = CellType.Wall, Direction = Direction.Right
                },
                new Cell {
                    CellType = CellType.Empty, Direction = Direction.Top
                },

                new Cell {
                    CellType = CellType.Wall, Direction = Direction.TopLeft
                },
                new Cell {
                    CellType = CellType.Wall, Direction = Direction.TopRight
                }
            };

            expectedSurrounds.Should().BeEquivalentTo(surround);
        }
Ejemplo n.º 2
0
        public void ShouldParseMapToCorrectLabirint()
        {
            var map         = @"
1R1 
1 1 
1Q1";
            var lab         = LabirintParser.Parse(map);
            var expectedLab = new CellType[3, 4]
            {
                { CellType.Wall, CellType.Empty, CellType.Wall, CellType.Empty },
                { CellType.Wall, CellType.Empty, CellType.Wall, CellType.Empty },
                { CellType.Wall, CellType.Exit, CellType.Wall, CellType.Empty }
            };

            Assert.Equal(expectedLab, lab.Cells);
            Assert.Equal((1, 0), lab.RobotPosition);
        }