public void GetPresentationBlack()
 {
     var p = new EnglishFENPresentation();
     var pl = new Player(2);
     var o = new ChessPiece { Type = PieceTypes.Rook, Player = pl };
     Assert.AreEqual('r', p.GetPresentation(o));
 }
 public void GetPresentationWhite()
 {
     var p = new FigurinePresentation();
     var pl = new Player(1);
     var o = new ChessPiece { Type = PieceTypes.Rook, Player = pl };
     Assert.AreEqual('♖', p.GetPresentation(o));
 }
 public void GetEmptyCell()
 {
     var p = new FigurinePresentation();
     var pl = new Player(2);
     var o = new ChessPiece { IsEmpty = true };
     Assert.AreEqual(null, p.GetPresentation(o));
 }
Example #4
0
        public void CastlingBarrierQ()
        {
            var c = new CastlingTemplate(CastlingTemplate.CastlingType.Queenside);

            var from = new Position(5, 1);
            var to = new Position(3, 1);
            var rook = new Position(1, 1);
            var enmy = new Position(2, 1);
            var white = new Player(1);

            var s = new ChessState();
            s[rook] = new ChessPiece { Type = PieceTypes.Rook, Player = white };
            s[rook].Move(rook);
            s[from] = new ChessPiece { Type = PieceTypes.King, Player = white };
            s[from].Move(from);
            s[enmy] = new ChessPiece { Type = PieceTypes.Rook, Player = white };
            s[enmy].Move(enmy);

            Assert.IsFalse(c.CanApply(from, to, s));
        }
Example #5
0
        public void RookPathUnderAttack()
        {
            var c = new CastlingTemplate(CastlingTemplate.CastlingType.Kingside);

            var from = new Position(5, 1);
            var to = new Position(7, 1);
            var rook = new Position(8, 1);
            var enmy = new Position(8, 3);
            var white = new Player(1);

            var s = new ChessState();
            s[rook] = new ChessPiece { Type = PieceTypes.Rook, Player = white };
            s[rook].Move(rook);
            s[from] = new ChessPiece { Type = PieceTypes.King, Player = white };
            s[from].Move(from);
            s[enmy] = new ChessPiece { Type = PieceTypes.Rook, Player = new Player(2) };
            s[enmy].Move(enmy);
            ChessPieceFactory.AddMoves((ChessPiece)s[enmy]);

            Assert.IsTrue(c.CanApply(from, to, s));
        }