예제 #1
0
        public void Equals_TwoOppositeColorRooks_AreNotEqual()
        {
            Rook rook1 = new Rook(new Board(), PieceColor.White);
            Rook rook2 = new Rook(new Board(), PieceColor.Black);

            Assert.AreNotEqual(rook1, rook2);
        }
예제 #2
0
        public void Equals_TwoSameColorRooks_AreEqual()
        {
            Rook rook1 = new Rook(new Board(), PieceColor.White);
            Rook rook2 = new Rook(new Board(), PieceColor.White);
            Rook rook3 = new Rook(new Board(), PieceColor.Black);
            Rook rook4 = new Rook(new Board(), PieceColor.Black);

            Assert.AreEqual(rook1, rook2);
            Assert.AreEqual(rook3, rook4);
        }
예제 #3
0
        public void Setup_WhenBoardIsSetup_FirstAndEightFilePositionsOnTheFirstRankReturnWhiteRooks()
        {
            var expected = new Rook(Board, PieceColor.White);

            Board.Setup();

            Assert.AreEqual(expected, GetSquare(1, 1).Occupier);
            Assert.AreEqual(expected, GetSquare(8, 1).Occupier);
        }
예제 #4
0
        public void Move_WhiteKingMakesQueensideCastlingMove_QueensideRookIsMovedToKingsRightsidePosition()
        {
            var expected = new Rook(Board, PieceColor.White);
            Board.SetSquare(5, 1, new King(Board, PieceColor.White));
            Board.SetSquare(1, 1, expected);

            Board.Move(GetSquare(5, 1), GetSquare(3, 1));
            var actual = GetSquare(4, 1).Occupier;

            Assert.AreEqual(expected, actual);
        }
예제 #5
0
        public void Move_WhiteKingMakesKingsideCastlingMove_QueensideRookIsNotMoved()
        {
            var expected = new Rook(Board, PieceColor.White);
            Board.SetSquare(5, 1, new King(Board, PieceColor.White));
            Board.SetSquare(8, 1, new Rook(Board, PieceColor.White));
            Board.SetSquare(1, 1, expected);

            Board.Move(GetSquare(5, 1), GetSquare(7, 1));
            var actual = GetSquare(1, 1).Occupier;

            Assert.AreEqual(expected, actual);
        }
예제 #6
0
        public void Move_BlackKingMakesQueensideCastlingMove_QueensideRookIsMoveToKingsLeftsidePosition()
        {
            var expected = new Rook(Board, PieceColor.Black);
            Board.SetSquare(5, 8, new King(Board, PieceColor.Black));
            Board.SetSquare(1, 8, expected);

            Board.Move(GetSquare(5, 8), GetSquare(3, 8));
            var actual = GetSquare(4, 8).Occupier;

            Assert.AreEqual(expected, actual);
        }
예제 #7
0
        public void Move_BlackKingMakesQueensideCastlingMove_KingsideRookIsNotMoved()
        {
            var expected = new Rook(Board, PieceColor.White);
            Board.SetSquare(5, 8, new King(Board, PieceColor.White));
            Board.SetSquare(1, 8, new Rook(Board, PieceColor.White));
            Board.SetSquare(8, 8, expected);

            Board.Move(GetSquare(5, 8), GetSquare(3, 8));
            var actual = GetSquare(8, 8).Occupier;

            Assert.AreEqual(expected, actual);
        }
예제 #8
0
        public void Move_BlackKingMakesKingsideCastlingMove_KingsideRookIsMovedToKingsRightsidePosition()
        {
            var expected = new Rook(Board, PieceColor.Black);
            Board.SetSquare(5, 8, new King(Board, PieceColor.Black));
            Board.SetSquare(8, 8, expected);

            Board.Move(GetSquare(5, 8), GetSquare(7, 8));
            var actual = GetSquare(6, 8).Occupier;

            Assert.AreEqual(expected, actual);
        }