public void TestCanPosAt_Wrong_X_Pos() { Board board = new Board(10, 20); Piece p1 = PieceFactory.GetPiecebyId(1); Assert.IsFalse(board.CanPosAt(p1, -1, -1)); }
public void TestCanPosAt_Init_Piece_Pos() { Board board = new Board(10, 20); Piece p1 = PieceFactory.GetPiecebyId(1); Assert.IsTrue(board.CanPosAt(p1, 0, -1)); }
public void TestCanPosAt() { Board board = new Board(10, 20); Piece p1 = PieceFactory.GetPiecebyId(0); Assert.IsTrue(board.CanPosAt(p1, 0, 0)); }
public void TestCanPosAt_Wrong_Pos() { Board board = new Board(10, 20); Piece p1 = PieceFactory.GetPiecebyId(0); board.FixPiece(p1, 0, 0); Assert.IsFalse(board.CanPosAt(p1, 0, 0)); }
public void TestGetPieceById_WrongId() { PieceFactory.Initialize(); Piece actual = PieceFactory.GetPiecebyId(9); Piece expected = null; Assert.AreEqual(expected, actual); }
public void TestGetPieceById() { PieceFactory.Initialize(); Piece actual = PieceFactory.GetPiecebyId(0); Piece expected = new Piece(new int[, ] { { 1, 1, 1, 1 } }); CollectionAssert.AreEqual(expected.ToArray(), actual.ToArray()); }
public void TestIsTopReached_Not_Reached() { Board board = new Board(10, 20); Piece p1 = PieceFactory.GetPiecebyId(0); Piece p2 = PieceFactory.GetPiecebyId(1); board.FixPiece(p1, 0, 1); board.FixPiece(p1, 4, 2); board.FixPiece(p2, 8, 3); Assert.IsFalse(board.IsTopReached()); }
public void TestCheckLines() { Board board = new Board(10, 20); Piece p1 = PieceFactory.GetPiecebyId(0); Piece p2 = PieceFactory.GetPiecebyId(1); board.FixPiece(p1, 0, 0); board.FixPiece(p1, 4, 0); board.FixPiece(p2, 8, 0); board.FixPiece(p1, 0, 1); board.FixPiece(p1, 4, 1); board.FixPiece(p2, 8, 1); Assert.AreEqual(2, board.CheckLines()); }
public void TestFixPiece_Wrong_X_Pos() { Board board = new Board(10, 20); Piece piece = PieceFactory.GetPiecebyId(1); board.FixPiece(piece, -3, -1); for (int i = 0; i < board.Height; ++i) { for (int j = 0; j < board.Width; ++j) { Assert.AreEqual(0, board[i, j]); } } }
public void TestFixPiece_Init_Pos_Fix() { Board board = new Board(10, 20); Piece piece = PieceFactory.GetPiecebyId(1); board.FixPiece(piece, 3, -1); for (int i = 3; i < 3 + piece.Width; ++i) { Assert.AreEqual(2, board[0, i]); } for (int i = 0; i < board.Height; ++i) { for (int j = 0; j < board.Width; ++j) { if (i == 0 && j >= 3 && j < 3 + piece.Width) { continue; } Assert.AreEqual(0, board[i, j]); } } }