public void TestChestSymbolGetter() { char excpected = 'K'; ChessPiece testPiece = new ChessPiece(excpected, 2, 3); bool check = testPiece.Symbol == excpected; Assert.IsTrue(check); }
public void TestChestPieceSecondaryConstructorX() { char excpected = 'K'; ChessPiece testPiece = new ChessPiece(excpected, 2 ,3); int x = 2; Assert.AreEqual(x, testPiece.XCoord); }
public void TestChestPieceSecondaryConstructorY() { char excpected = 'K'; ChessPiece testPiece = new ChessPiece(excpected, 2, 3); int y = 3; Assert.AreEqual(y, testPiece.YCoord); }
public void TestChestPieceConstructorY() { char excpected = 'K'; Coordinates newCoordinates = new Coordinates(2, 3); int x = newCoordinates.XCoord; int y = newCoordinates.YCoord; ChessPiece testPiece = new ChessPiece(excpected, newCoordinates); Assert.AreEqual(y, testPiece.YCoord); }
public void TestConstructor_CreatePawnWithValidParameters() { ChessPiece chessPiece = new ChessPiece(ChessPieceType.Pawn, 'A', 7, 7); Assert.AreEqual(ChessPieceType.Pawn, chessPiece.Type); Assert.AreEqual('A', chessPiece.Character); Assert.AreEqual(7, chessPiece.Row); Assert.AreEqual(7, chessPiece.Col); }
public void TestConstructor_CreateKingWithValidParameters() { ChessPiece chessPiece = new ChessPiece(ChessPieceType.King, 'K', 3, 7); Assert.AreEqual(ChessPieceType.King, chessPiece.Type); Assert.AreEqual('K', chessPiece.Character); Assert.AreEqual(3, chessPiece.Row); Assert.AreEqual(7, chessPiece.Col); }
public void TestChessPieceClone() { ChessPiece chessPiece = new ChessPiece(ChessPieceType.Pawn, 'A', 7, 7); ChessPiece newChessPiece = (ChessPiece)chessPiece.Clone(); Assert.IsFalse(object.ReferenceEquals(chessPiece, newChessPiece)); Assert.IsTrue(chessPiece.Row == newChessPiece.Row); Assert.IsTrue(chessPiece.Col == newChessPiece.Col); Assert.IsTrue(chessPiece.Character == newChessPiece.Character); Assert.IsTrue(chessPiece.Type == newChessPiece.Type); }
/// <summary> /// Performs a deep copy of the <see cref="ChessPiece"/> object. /// </summary> /// <returns>A copy of the object being cloned.</returns> public object Clone() { ChessPiece clone = new ChessPiece(this.Type, this.Character, this.Row, this.Col); clone.MovesMade = this.MovesMade; return clone; }
private void UpdatePosition(ChessPiece chessPiece, Move move) { this.occupied[chessPiece.Row, chessPiece.Col] = false; chessPiece.Row += move.DeltaRow; chessPiece.Col += move.DeltaCol; chessPiece.MovesMade++; this.occupied[chessPiece.Row, chessPiece.Col] = true; }
public void TestConstructor_WhitespaceCharacterThrowsException() { ChessPiece chessPiece = new ChessPiece(ChessPieceType.King, ' ', 3, 3); }