Ejemplo n.º 1
0
        public void LocationContainsPieceReturnsFalseForAppropriatePieceTypeAndDifferentProvidedColor1()
        {
            var chessboard        = ChessboardProvider.GetChessboardClassicWithNoPieces();
            var whitePawnPosition = new Position(1, 1);

            chessboard[whitePawnPosition].Piece = new Pawn(PieceColor.White);

            Assert.IsFalse(Utilities.LocationContainsPiece <Pawn>(chessboard[whitePawnPosition], PieceColor.Black));
        }
Ejemplo n.º 2
0
        public void LocationContainsPieceReturnsFalseForAppropriatePieceTypeAndDifferentProvidedColor2()
        {
            var chessboard          = ChessboardProvider.GetChessboardClassicWithNoPieces();
            var blackBishopPosition = new Position(3, 3);

            chessboard[blackBishopPosition].Piece = new Bishop(PieceColor.Black);

            Assert.IsFalse(Utilities.LocationContainsPiece <Bishop>(chessboard[blackBishopPosition], PieceColor.White));
        }
Ejemplo n.º 3
0
        public void LocationContainsPieceReturnsFalseForDifferentPieceTypeWithoutProvidingColor1()
        {
            var chessboard        = ChessboardProvider.GetChessboardClassicWithNoPieces();
            var whitePawnPosition = new Position(1, 1);

            chessboard[whitePawnPosition].Piece = new Pawn(PieceColor.White);

            Assert.IsFalse(Utilities.LocationContainsPiece <Queen>(chessboard[whitePawnPosition]));
        }
Ejemplo n.º 4
0
        public void LocationContainsPieceReturnsFalseForDifferentPieceTypeWithoutProvidingColor2()
        {
            var chessboard          = ChessboardProvider.GetChessboardClassicWithNoPieces();
            var blackBishopPosition = new Position(3, 3);

            chessboard[blackBishopPosition].Piece = new Bishop(PieceColor.Black);

            Assert.IsFalse(Utilities.LocationContainsPiece <Rook>(chessboard[blackBishopPosition]));
        }
Ejemplo n.º 5
0
        public void LocationContainsPieceReturnsTrueForAppropriatePieceTypeWithoutProvidingColor2()
        {
            var chessboard          = ChessboardProvider.GetChessboardClassicWithNoPieces();
            var blackBishopPosition = new Position(3, 3);

            chessboard[blackBishopPosition].Piece = new Bishop(PieceColor.Black);

            Assert.IsTrue(Utilities.LocationContainsPiece <Bishop>(chessboard[blackBishopPosition]));
        }
Ejemplo n.º 6
0
        public void PieceIsThreatenedByKingReturnsFalseIfBlackKingIntersectsBlackPiece()
        {
            chessboard = ChessboardProvider.GetChessboardClassicWithNoPieces();

            var blackPawnPosition = new Position(2, 2);
            var blackKingPosition = new Position(blackPawnPosition.Row + 1, blackPawnPosition.Column + 1);

            chessboard[blackPawnPosition].Piece = new Pawn(PieceColor.Black);
            chessboard[blackKingPosition].Piece = new King(PieceColor.Black);

            var threatened = chessboard.PieceIsThreatenedByKing(blackPawnPosition);

            Assert.IsFalse(threatened);
        }
Ejemplo n.º 7
0
        public void PieceIsThreatenedByQueenReturnsTrueIfWhiteQueenIntersectsBlackPiece()
        {
            chessboard = ChessboardProvider.GetChessboardClassicWithNoPieces();

            var blackPawnPosition  = new Position(2, 2);
            var whiteQueenPosition = new Position(blackPawnPosition.Row + 2, blackPawnPosition.Column + 2);

            chessboard[blackPawnPosition].Piece  = new Pawn(PieceColor.Black);
            chessboard[whiteQueenPosition].Piece = new Queen(PieceColor.White);

            var threatened = chessboard.PieceIsThreatenedByQueen(blackPawnPosition);

            Assert.IsTrue(threatened);
        }
Ejemplo n.º 8
0
        public void PieceIsThreatenedByKingReturnsFalseIfWhiteKingIntersectsWhitePiece()
        {
            chessboard = ChessboardProvider.GetChessboardClassicWithNoPieces();

            var whitePawnPosition = new Position(2, 2);
            var whiteKingPosition = new Position(whitePawnPosition.Row + 1, whitePawnPosition.Column + 1);

            chessboard[whitePawnPosition].Piece = new Pawn(PieceColor.White);
            chessboard[whiteKingPosition].Piece = new King(PieceColor.White);

            var threatened = chessboard.PieceIsThreatenedByKing(whitePawnPosition);

            Assert.IsFalse(threatened);
        }
Ejemplo n.º 9
0
        public void PieceIsThreatenedByBishopsReturnsTrueIfBlackBishopIntersectsWhitePiece()
        {
            chessboard = ChessboardProvider.GetChessboardClassicWithNoPieces();

            var whitePawnPosition   = new Position(2, 2);
            var blackBishopPosition = new Position(whitePawnPosition.Row + 2, whitePawnPosition.Column + 2);

            chessboard[whitePawnPosition].Piece   = new Pawn(PieceColor.White);
            chessboard[blackBishopPosition].Piece = new Bishop(PieceColor.Black);

            var threatened = chessboard.PieceIsThreatenedByBishops(whitePawnPosition);

            Assert.IsTrue(threatened);
        }
Ejemplo n.º 10
0
 public void Setup()
 {
     chessboard = ChessboardProvider.GetChessboardClassicWithNoPieces();
 }