Exemple #1
0
        public void Avoids_Duplicate_Positioning()
        {
            var firstPawn  = new Pawn(PieceColor.Black, _chessBoard);
            var secondPawn = new Pawn(PieceColor.Black, _chessBoard);

            _chessBoard.Add(firstPawn, 6, 3);
            _chessBoard.Add(secondPawn, 6, 3);
            Assert.AreEqual(firstPawn.Get_X_Coord(), 6);
            Assert.AreEqual(firstPawn.Get_Y_Coord(), 3);
            Assert.AreEqual(secondPawn.Get_X_Coord(), -1);
            Assert.AreEqual(secondPawn.Get_Y_Coord(), -1);
        }
Exemple #2
0
        public void Avoids_Duplicate_Positioning()
        {
            Pawn firstPawn  = new Pawn(PieceColor.Black);
            Pawn secondPawn = new Pawn(PieceColor.Black);

            chessBoard.Add(firstPawn, 6, 3, PieceColor.Black);
            chessBoard.Add(secondPawn, 6, 3, PieceColor.Black);
            Assert.AreEqual(firstPawn.XCoordinate, 6);
            Assert.AreEqual(firstPawn.YCoordinate, 3);
            Assert.AreEqual(secondPawn.XCoordinate, -1);
            Assert.AreEqual(secondPawn.YCoordinate, -1);
        }
Exemple #3
0
 public void ChessBoard_Add_Sets_XCoordinate()
 {
     // Positive movement
     chessBoard.Add(pawnPositive, 1, 3);
     Assert.AreEqual(1, pawnPositive.XCoordinate);
     // Negative movement
     chessBoard.Add(pawnPositive, 6, 3);
     Assert.AreEqual(6, pawnPositive.XCoordinate);
 }
Exemple #4
0
 public void ChessBoard_Add_Sets_XCoordinate()
 {
     chessBoard.Add(pawn, 6, 3);
     Assert.AreEqual(pawn.XCoordinate, 6);
 }
Exemple #5
0
 public void ChessBoard_Add_Sets_XCoordinate()
 {
     chessBoard.Add(pawn, 6, 3, PieceColor.Black);
     Assert.AreEqual(pawn.XCoordinate, 6);
 }
        public void ChessBoard_Add_Sets_XCoordinate()
        {
            m_chessBoard.Add(m_blackPawn, 3, 6);

            Assert.AreEqual(m_blackPawn.XCoordinate, 3);
            Assert.IsTrue(m_chessBoard.HasPieces);
        }
 public virtual void ChessBoard_Add_Sets_XCoordinate()
 {
     chessBoard.Add(pawn, 5, 3, pieceColor);
     Assert.AreEqual(pawn.XCoordinate, 5);
 }
Exemple #8
0
        public void Avoids_Duplicate_Positioning()
        {
            Pawn firstPawn  = new Pawn(PieceColor.Black, MovementDirection.Negative);
            Pawn secondPawn = new Pawn(PieceColor.Black, MovementDirection.Negative);

            chessBoard.Add(firstPawn, 6, 3);
            try
            {
                chessBoard.Add(secondPawn, 6, 3);
                Assert.Fail("Chessboard was able to add a piece to an already-occupied position.");
            }
            catch (DuplicatePositioningException)
            { /* pass */ }
            Assert.AreEqual(6, firstPawn.XCoordinate);
            Assert.AreEqual(3, firstPawn.YCoordinate);
            Assert.AreEqual(-1, secondPawn.XCoordinate);
            Assert.AreEqual(-1, secondPawn.YCoordinate);
        }