Beispiel #1
0
        public void Test_RemoveFigureWhitNotExistFigure()
        {
            Player tested = new Player("Test", ChessColor.White);
            Pawn testPawn = new Pawn(ChessColor.White);

            tested.RemoveFigure(testPawn);
        }
Beispiel #2
0
        public void Test_RemoveFigureWhitInvalidColor()
        {
            Player tested = new Player("Test", ChessColor.White);
            Pawn testPawn = new Pawn(ChessColor.Black);

            tested.RemoveFigure(testPawn);
        }
Beispiel #3
0
        public void Test_AddFigureWhitValidData()
        {
            Player tested = new Player("Test", ChessColor.White);
            Pawn testPawn = new Pawn(ChessColor.White);

            tested.AddFigure(testPawn);
        }
        public void Test_AddFigureWhitValidFigureAndInvalidPosition()
        {
            Board testBoard = new Board();
            Position position = new Position(-61, 'q');
            Pawn testPawn = new Pawn(ChessColor.White);

            testBoard.AddFigure(testPawn, position);
        }
        public void Test_AddFigureWhitValidData()
        {
            Board testBoard = new Board();
            Position position = new Position(5, 'a');
            Pawn testPawn = new Pawn(ChessColor.White);

            testBoard.AddFigure(testPawn, position);

            Assert.AreSame(testPawn, testBoard.GetFigureAtPosition(position));
        }
 private void AddPawnsToBoardRow(IPlayer player, IBoard board, int chessRow)
 {
     for (int i = 0; i < BoardTotalRowsAndCols; i++)
     {
         var pawn = new Pawn(player.Color);
         player.AddFigure(pawn);
         var position = new Position(chessRow, (char)(i + 'a'));
         board.AddFigure(pawn, position);
     }
 }
        public void Test_MoveFigureAtPositionWhitInvalidFromPosition()
        {
            Board testBoard = new Board();
            Position fromPosition = new Position(2, 'a');
            Position invalidFromPosition = new Position(0, '1');
            Position toPosition = new Position(4, 'a');
            Pawn testPawn = new Pawn(ChessColor.White);

            testBoard.AddFigure(testPawn, fromPosition);

            testBoard.MoveFigureAtPosition(testPawn, invalidFromPosition, toPosition);
        }
        public void Test_MoveFigureAtPositionWhitValidData()
        {
            Board testBoard = new Board();
            Position fromPosition = new Position(2, 'a');
            Position toPosition = new Position(4, 'a');
            Pawn testPawn = new Pawn(ChessColor.White);

            testBoard.AddFigure(testPawn, fromPosition);

            testBoard.MoveFigureAtPosition(testPawn, fromPosition, toPosition);

            bool result = (testPawn == testBoard.GetFigureAtPosition(toPosition)) &&
                (testBoard.GetFigureAtPosition(fromPosition) == null);

            Assert.IsTrue(result);
        }