public void PawnMovedButNotInBoard()
        {
            Board board = new Board(BoardCommon.GRID_12X8);
            Pawn pawn = new Pawn("Add", board, new Point(board.Width / 2, board.Height / 2));

            // Expect an ArgumentException because the pawn doesn't exist on the board yet
            Assert.Throws<ArgumentException>(delegate () {
                pawn.Offset(Point.One);
            }, "Offset was called on a Pawn that was not added to a Board");
        }
        public void MoveIntoWall()
        {
            Board board = new Board(BoardCommon.GRID_12X8);
            Pawn pawn = new Pawn("Mover", board, Point.One, null, true, true);

            board.AddPawn(pawn);

            Point expectedPosition = new Point(2, 1);

            bool moveRight = pawn.Offset(Point.Right);
            Point position1 = pawn.Position;

            bool moveUp = pawn.Offset(Point.Up);
            Point position2 = pawn.Position;

            Assert.IsTrue(moveRight, "Offset returned false when moving right");
            Assert.AreEqual(expectedPosition, position1, "Pawn failed to move right to open tile");

            Assert.IsFalse(moveUp, "Offset returned true when moving up into a wall");
            Assert.AreEqual(expectedPosition, position2, "Pawn failed to stay on one goddamn place");
        }
        public void MoveSolidPawnIntoSolidPawn()
        {
            Board board = new Board(BoardCommon.GRID_12X8);

            Point pos1 = new Point(6, 4);
            Point pos2 = new Point(8, 4);

            Pawn pawn1 = new Pawn("First", board, pos1, null, true, true, true);
            Pawn pawn2 = new Pawn("Second", board, pos2, null, true, true, true);

            board.AddPawn(pawn1);
            board.AddPawn(pawn2);

            Point expectedPosition = new Point(7, 4);

            bool firstMove = pawn2.Offset(Point.Left);
            Point firstPosition = pawn2.Position;

            bool secondMove = pawn2.Offset(Point.Left);
            Point secondPosition = pawn2.Position;

            Assert.IsTrue(firstMove, "Pawn was not able to move left one tile");
            Assert.IsFalse(secondMove, "Pawn somehow passed through another solid pawn");

            Assert.AreEqual(expectedPosition, firstPosition, "Pawn could not move to free tile");
            Assert.AreEqual(expectedPosition, secondPosition, "Pawn somehow passed through another solid pawn");
        }
        public void SolidPawnsMoveIntoSharedCell()
        {
            Board board = new Board(BoardCommon.GRID_12X8);

            Point pos1 = new Point(6, 4);
            Point pos2 = new Point(8, 4);

            Point pos3 = new Point(7, 4);

            Pawn pawn1 = new Pawn("First", board, pos1, null, true, true, true);
            Pawn pawn2 = new Pawn("Second", board, pos2, null, true, true, true);

            board.AddPawn(pawn1);
            board.AddPawn(pawn2);

            Assert.IsTrue(pawn1.Offset(Point.Right),"Pawn tried to move from " + pos1 + " to " + pos3 + " but was blocked by something");
            Assert.IsFalse(pawn2.Offset(Point.Left), "Pawn moved from " + pos2 + " to " + pos3 + " when it should've been blocked");

            Assert.AreEqual(pos3, pawn1.Position, "Pawn was not able to move from " + pos1 + " to " + pos3);
            Assert.AreEqual(pos2, pawn2.Position, "Pawn was able to move from " + pos3 + " to " + pos2);
        }
        public void SolidPawnsMoveIntoEachOther()
        {
            Board board = new Board(BoardCommon.GRID_12X8);

            Point pos1 = new Point(6, 4);
            Point pos2 = new Point(7, 4);

            Pawn pawn1 = new Pawn("First", board, pos1, null, true, true, true);
            Pawn pawn2 = new Pawn("Second", board, pos2, null, true, true, true);

            board.AddPawn(pawn1);
            board.AddPawn(pawn2);

            Assert.IsFalse(pawn1.Offset(Point.Right));
            Assert.IsFalse(pawn2.Offset(Point.Left));

            Assert.AreEqual(pos1, pawn1.Position);
            Assert.AreEqual(pos2, pawn2.Position);
        }