示例#1
0
        public void CheckMovies_Short_Castling_Occupied_Field()
        {
            //Arrange
            var chessboard   = new ChessboardModel(new ChessMovie());
            var pieceFactory = new ChessPieceFactory();

            chessboard["e1"].Piece = pieceFactory.Create(ColourOfPiece.White, KindOfPiece.King);
            chessboard["h1"].Piece = pieceFactory.Create(ColourOfPiece.White, KindOfPiece.Rook);
            chessboard["a6"].Piece = pieceFactory.Create(ColourOfPiece.Black, KindOfPiece.Bishop);
            var castling = new Castling();
            //Act

            var receivedMovies = castling.CheckMovies(new Position("e1"), chessboard);

            //Assert
            Assert.AreEqual(receivedMovies.Count(), 0);
        }
示例#2
0
        public void CheckMovies_Short_Castling_Movie_Possible()
        {
            //Arrange
            var chessboard   = new ChessboardModel(new ChessMovie());
            var pieceFactory = new ChessPieceFactory();

            chessboard["e1"].Piece = pieceFactory.Create(ColourOfPiece.White, KindOfPiece.King);
            chessboard["h1"].Piece = pieceFactory.Create(ColourOfPiece.White, KindOfPiece.Rook);
            chessboard["a6"].Piece = pieceFactory.Create(ColourOfPiece.White, KindOfPiece.Bishop);
            var castling = new Castling();
            //Act

            var receivedMovies = castling.CheckMovies(new Position("e1"), chessboard);
            var expectedMovies = new List <string>()
            {
                "g1"
            };
            var commonMovies = receivedMovies.Intersect(expectedMovies);

            //Assert
            Assert.AreEqual(expectedMovies.Count(), commonMovies.Count());
        }