public void IEraseTest() { TetrisPiece piece = new TetrisPiece(PieceType.I); piece.EraseRow(4); List <Square> squares = piece.OccupiedSquares; Assert.AreEqual(4, squares.Count); Assert.IsTrue(squares.Any(s => s.Y == 1 && s.X == 5)); Assert.IsTrue(squares.Any(s => s.Y == 2 && s.X == 5)); Assert.IsTrue(squares.Any(s => s.Y == 3 && s.X == 5)); Assert.IsTrue(squares.Any(s => s.Y == 4 && s.X == 5)); piece.EraseRow(4); squares = piece.OccupiedSquares; Assert.AreEqual(3, squares.Count); Assert.IsTrue(squares.Any(s => s.Y == 2 && s.X == 5)); Assert.IsTrue(squares.Any(s => s.Y == 3 && s.X == 5)); Assert.IsTrue(squares.Any(s => s.Y == 4 && s.X == 5)); piece.EraseRow(4); squares = piece.OccupiedSquares; Assert.AreEqual(2, squares.Count); Assert.IsTrue(squares.Any(s => s.Y == 3 && s.X == 5)); Assert.IsTrue(squares.Any(s => s.Y == 4 && s.X == 5)); piece.EraseRow(4); squares = piece.OccupiedSquares; Assert.AreEqual(1, squares.Count); Assert.IsTrue(squares.Any(s => s.Y == 4 && s.X == 5)); piece.EraseRow(4); squares = piece.OccupiedSquares; Assert.AreEqual(0, squares.Count); }
public void IRotateEraseTest() { TetrisPiece piece = new TetrisPiece(PieceType.I); piece.Rotate(); piece.EraseRow(2); List <Square> squares = piece.OccupiedSquares; Assert.AreEqual(4, squares.Count); Assert.IsTrue(squares.Any(s => s.Y == 2 && s.X == 4)); Assert.IsTrue(squares.Any(s => s.Y == 2 && s.X == 5)); Assert.IsTrue(squares.Any(s => s.Y == 2 && s.X == 6)); Assert.IsTrue(squares.Any(s => s.Y == 2 && s.X == 7)); piece.EraseRow(2); squares = piece.OccupiedSquares; Assert.AreEqual(0, squares.Count); }