public void TestIsPieceOnEdgeAllEdges() { mockBoard = new MockLabyrinthBoard(mockLabyrinthEmpty); // Positioning the piece in the beginning. for (int i = 0; i < LabyrinthBoard.PIECE_INITIAL_POSITION; i++) { mockBoard.MovePieceLeft(); mockBoard.MovePieceUp(); } for (int i = 0; i < LabyrinthBoard.LABYRINTH_SIZE - 1; i++) { Assert.IsTrue(mockBoard.IsPieceOnEdge()); mockBoard.MovePieceRight(); } Assert.IsTrue(mockBoard.IsPieceOnEdge()); for (int i = 0; i < LabyrinthBoard.LABYRINTH_SIZE - 1; i++) { Assert.IsTrue(mockBoard.IsPieceOnEdge()); mockBoard.MovePieceDown(); } Assert.IsTrue(mockBoard.IsPieceOnEdge()); for (int i = 0; i < LabyrinthBoard.LABYRINTH_SIZE - 1; i++) { Assert.IsTrue(mockBoard.IsPieceOnEdge()); mockBoard.MovePieceLeft(); } Assert.IsTrue(mockBoard.IsPieceOnEdge()); for (int i = 0; i < LabyrinthBoard.LABYRINTH_SIZE - 1; i++) { Assert.IsTrue(mockBoard.IsPieceOnEdge()); mockBoard.MovePieceUp(); } Assert.IsTrue(mockBoard.IsPieceOnEdge()); }
public void TestIsPieceOnEdgeAllInternal() { mockBoard = new MockLabyrinthBoard(mockLabyrinthEmpty); // Positioning the piece in the beginning, one position away from the edge. for (int i = 0; i < LabyrinthBoard.PIECE_INITIAL_POSITION - 1; i++) { mockBoard.MovePieceLeft(); mockBoard.MovePieceUp(); } for (int i = 1; i < LabyrinthBoard.LABYRINTH_SIZE - 2; i++) { Assert.IsFalse(mockBoard.IsPieceOnEdge()); mockBoard.MovePieceRight(); } Assert.IsFalse(mockBoard.IsPieceOnEdge()); for (int i = 1; i < LabyrinthBoard.LABYRINTH_SIZE - 2; i++) { Assert.IsFalse(mockBoard.IsPieceOnEdge()); mockBoard.MovePieceDown(); } Assert.IsFalse(mockBoard.IsPieceOnEdge()); for (int i = 1; i < LabyrinthBoard.LABYRINTH_SIZE - 2; i++) { Assert.IsFalse(mockBoard.IsPieceOnEdge()); mockBoard.MovePieceLeft(); } Assert.IsFalse(mockBoard.IsPieceOnEdge()); for (int i = 1; i < LabyrinthBoard.LABYRINTH_SIZE - 2; i++) { Assert.IsFalse(mockBoard.IsPieceOnEdge()); mockBoard.MovePieceUp(); } Assert.IsFalse(mockBoard.IsPieceOnEdge()); }
public void TestMovePieceUpImpossible() { mockBoard = new MockLabyrinthBoard(mockLabyrinthStuck); mockBoard.MovePieceUp(); char[,] charRepresentation = GetCharArray(mockBoard); Assert.AreEqual('*', charRepresentation[LabyrinthBoard.PIECE_INITIAL_POSITION, LabyrinthBoard.PIECE_INITIAL_POSITION - 1]); }