コード例 #1
0
        public void TestTryMoveKing_CommandKingUpLeft2()
        {
            ChessboardManager chessboardManager = new ChessboardManager();

            ChessPiece chessPieceBefore = chessboardManager.GetChessPiece('K');

            bool success = chessboardManager.TryMoveKing("KUL");

            Assert.IsTrue(success);

            ChessPiece chessPieceAfter = chessboardManager.GetChessPiece('K');

            Assert.AreEqual(chessPieceBefore.Row - 1, chessPieceAfter.Row, "King position is incorrect.");
            Assert.AreEqual(chessPieceBefore.Col - 1, chessPieceAfter.Col, "King position is incorrect.");
        }
コード例 #2
0
        public void TestTryMovePawn_CommandPawnDownRight2()
        {
            ChessboardManager chessboardManager = new ChessboardManager();

            ChessPiece chessPieceBefore = chessboardManager.GetChessPiece('A');

            bool success = chessboardManager.TryMovePawn("ADR");

            Assert.IsTrue(success);

            ChessPiece chessPieceAfter = chessboardManager.GetChessPiece('A');

            Assert.AreEqual(chessPieceBefore.Row + 1, chessPieceAfter.Row, "Pawn position is incorrect.");
            Assert.AreEqual(chessPieceBefore.Col + 1, chessPieceAfter.Col, "Pawn position is incorrect.");
        }
コード例 #3
0
        public void TestGetChessPiece_ThrowsException()
        {
            ChessboardManager chessboardManager = new ChessboardManager();

            ChessPiece chessPiece = chessboardManager.GetChessPiece('E');
        }