Пример #1
0
        public void IsEmptySquare_False()
        {
            Pawn pawn = new Pawn(PieceColor.Black);

            Assert.IsTrue(_chessBoard.AddPiece(pawn, 5, 5));
            Assert.IsFalse(_chessBoard.IsSquareEmpty(5, 5));
        }
Пример #2
0
        public void SetUpPieces(ChessBoard board)
        {
            var layout = StartingLayout.GetLayout();

            foreach (var whatWhere in layout)
            {
                board.AddPiece(PieceFactory.Create(whatWhere.PieceType), whatWhere.Location);
            }
        }
Пример #3
0
        public void AddPieceToLocation()
        {
            var chessBoard = new ChessBoard();

            var piece = new MockPiece();

            ILocation location = new MockLocation(3, 6);

            chessBoard.AddPiece(piece, location);

            var content = chessBoard.Board[location.y][location.x].BoardSquareContent;

            Assert.AreEqual(piece, content);
        }
Пример #4
0
        public void KingNotValidMoveTest()
        {
            var chessBoard = new ChessBoard();

            var piece = new MockKing();

            ILocation startLocation = new MockLocation(3, 6);

            chessBoard.AddPiece(piece, startLocation);

            ILocation endLocation = new MockLocation(0, 0);

            chessBoard.MovePiece(startLocation, endLocation);

            var content = chessBoard.Board[endLocation.y][endLocation.x].BoardSquareContent;

            Assert.AreNotEqual(piece, content);
        }
Пример #5
0
 public void ChessBoard_Add_Sets_XCoordinate()
 {
     _chessBoard.AddPiece(_pawnBlack, 6, 3);
     Assert.AreEqual(6, _pawnBlack.XCoordinate);
 }