public IEnumerator TestRookArrayOfValidMovesAtStartingPosition() { BoardManager board = BoardManager.Instance; bool[,] expectedArray = new bool[8, 8]; // all false yield return(null); // Rook cannot move at start of game Piece whiteRook = board.Pieces[0, 0]; Assert.AreEqual(expectedArray, whiteRook.ArrayOfValidMove()); }
public IEnumerator TestQueenArrayOfValidMovesAtStartingPosition() { BoardManager board = BoardManager.Instance; bool[,] expectedArray = new bool[8, 8]; // all false yield return(null); // Queen cannot move at start of game Piece blackQueen = board.Pieces[3, 7]; Assert.AreEqual(expectedArray, blackQueen.ArrayOfValidMove()); }
public IEnumerator TestKnightArrayOfValidMovesAtStartingPosition() { BoardManager board = BoardManager.Instance; bool[,] expectedArray = new bool[8, 8]; expectedArray[5, 5] = true; expectedArray[7, 5] = true; yield return(null); Piece blackKnight = board.Pieces[6, 7]; Assert.AreEqual(expectedArray, blackKnight.ArrayOfValidMove()); }
public IEnumerator TestKingArrayOfValidMovesCanMove() { BoardManager board = BoardManager.Instance; bool[,] expectedArray = new bool[8, 8]; yield return(null); // Move pawn above king up one. King can now move up board.Pieces[4, 1].SetPosition(4, 2); board.Pieces[4, 2] = board.Pieces[4, 1]; board.Pieces[4, 1] = null; expectedArray[4, 1] = true; Piece whiteKing = board.Pieces[4, 0]; Assert.AreEqual(expectedArray, whiteKing.ArrayOfValidMove()); }
public IEnumerator TestBishopArrayOfValidMovesCanMove() { BoardManager board = BoardManager.Instance; bool[,] expectedArray = new bool[8, 8]; yield return(null); // Move down black pawn below right knight down one. board.Pieces[6, 6].SetPosition(6, 5); board.Pieces[6, 5] = board.Pieces[6, 6]; board.Pieces[6, 6] = null; expectedArray[6, 6] = true; expectedArray[7, 5] = true; Piece blackBishop = board.Pieces[5, 7]; Assert.AreEqual(expectedArray, blackBishop.ArrayOfValidMove()); }
public IEnumerator TestKnightArrayOfValidMovesCanCapture() { BoardManager board = BoardManager.Instance; bool[,] expectedArray = new bool[8, 8]; yield return(null); // Move black queen in path of white knight. board.Pieces[3, 7].SetPosition(2, 2); board.Pieces[2, 2] = board.Pieces[3, 7]; board.Pieces[3, 7] = null; expectedArray[0, 2] = true; expectedArray[2, 2] = true; Piece whiteKnight = board.Pieces[1, 0]; Assert.AreEqual(expectedArray, whiteKnight.ArrayOfValidMove()); }
public IEnumerator TestRookArrayOfValidMovesCanMove() { BoardManager board = BoardManager.Instance; bool[,] expectedArray = new bool[8, 8]; yield return(null); // Move left black pawn below roook down two. board.Pieces[0, 6].SetPosition(0, 4); board.Pieces[0, 4] = board.Pieces[0, 6]; board.Pieces[0, 6] = null; expectedArray[0, 6] = true; expectedArray[0, 5] = true; Piece blackRook = board.Pieces[0, 7]; Assert.AreEqual(expectedArray, blackRook.ArrayOfValidMove()); }
public IEnumerator TestQueenArrayOfValidMovesCanCapture() { BoardManager board = BoardManager.Instance; bool[,] expectedArray = new bool[8, 8]; yield return(null); // Remove white pawn left of queen. board.Pieces[2, 1] = null; // Move black pawn down to diagonal path of queen. board.Pieces[1, 6].SetPosition(1, 2); board.Pieces[1, 2] = board.Pieces[1, 6]; board.Pieces[1, 6] = null; expectedArray[2, 1] = true; expectedArray[1, 2] = true; Piece whiteQueen = board.Pieces[3, 0]; Assert.AreEqual(expectedArray, whiteQueen.ArrayOfValidMove()); }