예제 #1
0
        public void MoveOutsideOfBounds()
        {
            AsciiMapBoard mapBoard = new AsciiMapBoard(new char[1, 1] {
                { '@' }
            }, 1, 1, 0, 0);

            Assert.False(mapBoard.Move(MoveDirection.Down));
            Assert.False(mapBoard.Move(MoveDirection.Left));
            Assert.False(mapBoard.Move(MoveDirection.Up));
            Assert.False(mapBoard.Move(MoveDirection.Right));
        }
예제 #2
0
        public void MapMovement()
        {
            AsciiMapBoard mapBoard = new AsciiMapBoard(new char[2, 2] {
                { '1', '2' }, { '4', '3' }
            }, 2, 2, 0, 0);

            Assert.True(mapBoard.Move(MoveDirection.Right));
            Assert.Equal('2', mapBoard.CurrentElement);
            Assert.False(mapBoard.CurrentPositionVisited);

            Assert.True(mapBoard.Move(MoveDirection.Down));
            Assert.Equal('3', mapBoard.CurrentElement);
            Assert.False(mapBoard.CurrentPositionVisited);

            Assert.True(mapBoard.Move(MoveDirection.Left));
            Assert.Equal('4', mapBoard.CurrentElement);
            Assert.False(mapBoard.CurrentPositionVisited);

            Assert.True(mapBoard.Move(MoveDirection.Up));
            Assert.Equal('1', mapBoard.CurrentElement);
            Assert.True(mapBoard.CurrentPositionVisited);
        }