Example #1
0
        public void GetColorType_Returned()
        {
            // arrange
            var pawn = new TestPieceClass(PieceColor.Black);

            // act
            Assert.AreEqual("Pawn_Black", pawn.GetColorType());
        }
Example #2
0
        public void Move_No_ChessBoard_Failed()
        {
            // arrange
            var pawn       = new TestPieceClass(PieceColor.Black);
            var coordinate = new Coordinate(2, 3);

            // act
            pawn.Move(coordinate);
        }
Example #3
0
        public void CountLimit_Returned()
        {
            // act
            var pawn = new TestPieceClass(PieceColor.Black)
            {
                CoordinateValidator = mockCoordinateValidator.Object
            };

            // assert
            Assert.AreEqual(1, pawn.CountLimit);
        }
Example #4
0
        public void Move_Successful()
        {
            // arrange
            var chessBoard = new ChessBoard()
            {
                CoordinateValidator = mockCoordinateValidator.Object
            };
            var coordinate1 = new Coordinate(4, 3);
            var coordinate2 = new Coordinate(3, 3);
            var testPiece   = new TestPieceClass(PieceColor.Black);

            chessBoard.AddPiece(testPiece, coordinate1);

            // act
            testPiece.Move(coordinate2);

            // assert
            Assert.AreEqual(null, chessBoard.GetPiece(coordinate1));
            Assert.AreEqual(testPiece, chessBoard.GetPiece(coordinate2));
            Assert.AreEqual(chessBoard, testPiece.ChessBoard);
        }
Example #5
0
 public void Setup()
 {
     mockCoordinateValidator = new Mock <ICoordinateValidator>();
     testPieceClass          = new TestPieceClass(PieceColor.Black);
 }