Example #1
0
        public void PeekInsideBounds()
        {
            AsciiMapBoard mapBoard = new AsciiMapBoard(new char[3, 3] {
                { ' ', '1', ' ' },
                { ' ', '@', '3' },
                { ' ', 'a', ' ' }
            }, 3, 3, 1, 1);

            var element = mapBoard.PeekElement(MoveDirection.Up);

            Assert.NotNull(element);
            Assert.Equal('1', element);

            element = mapBoard.PeekElement(MoveDirection.Left);

            Assert.NotNull(element);
            Assert.Equal(' ', element);

            element = mapBoard.PeekElement(MoveDirection.Right);

            Assert.NotNull(element);
            Assert.Equal('3', element);

            element = mapBoard.PeekElement(MoveDirection.Down);

            Assert.NotNull(element);
            Assert.Equal('a', element);
        }
Example #2
0
        public void PeekOutsideOfBounds()
        {
            AsciiMapBoard mapBoard = new AsciiMapBoard(new char[1, 1] {
                { '@' }
            }, 1, 1, 0, 0);

            Assert.Null(mapBoard.PeekElement(MoveDirection.Down));
            Assert.Null(mapBoard.PeekElement(MoveDirection.Left));
            Assert.Null(mapBoard.PeekElement(MoveDirection.Up));
            Assert.Null(mapBoard.PeekElement(MoveDirection.Right));
        }