public void ShapeT_Reset() { IBoard board = new Board(); ShapeT shapeTest = new ShapeT(board); ShapeT shapeTest_expected = new ShapeT(board); String expected = "(5, 0)(6, 0)(4, 0)(5, 1)"; /* first row of the board * Initial position * * [ ][ ][ ][ ][c][a][b][ ][ ][ ] * [ ][ ][ ][ ][ ][d][ ][ ][ ][ ] */ //Act shapeTest.MoveDown(); shapeTest.MoveDown(); shapeTest.MoveLeft(); shapeTest.MoveLeft(); shapeTest.MoveLeft(); shapeTest.Rotate(); /* Should look like this after reset. * [ ][ ][ ][ ][c][a][b][ ][ ][ ] * [ ][ ][ ][ ][ ][d][ ][ ][ ][ ] * [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] * */ shapeTest.Reset(); //Assert Assert.AreEqual(expected, shapeTest.getPositionOfBlocks()); }
public void ShapeT_MoveLeft_NoSpace() { IBoard board = new Board(); ShapeT shapeTest = new ShapeT(board); ShapeT shapeTest_expected = new ShapeT(board); String expected = "(1, 0)(2, 0)(0, 0)(1, 1)"; /* First row of the board * Initial position * * [ ][ ][ ][ ][c][a][b][ ][ ][ ] * [ ][ ][ ][ ][ ][d][ ][ ][ ][ ] * */ shapeTest.MoveLeft(); shapeTest.MoveLeft(); shapeTest.MoveLeft(); shapeTest.MoveLeft(); /* Moved to the border. * * [c][a][b][ ][ ][ ][ ][ ][ ][ ] * [ ][d][ ][ ][ ][ ][ ][ ][ ][ ] * */ //Now move once more to check if it goes outside the board shapeTest.MoveLeft(); Assert.AreEqual(expected, shapeTest.getPositionOfBlocks()); }
public void ShapeT_MoveLeft_EnoughSpace() { IBoard board = new Board(); ShapeT shapeTest = new ShapeT(board); ShapeT shapeTest_expected = new ShapeT(board); String expected = "(4, 0)(5, 0)(3, 0)(4, 1)"; /* First row of the board * Initial position * * [ ][ ][ ][ ][c][a][b][ ][ ][ ] * [ ][ ][ ][ ][ ][d][ ][ ][ ][ ] * */ shapeTest.MoveLeft(); /* First row of the board * Initial position * [ ][ ][ ][c][a][b][ ][ ][ ][ ] * [ ][ ][ ][ ][d][ ][ ][ ][ ][ ] * */ Assert.AreEqual(expected, shapeTest.getPositionOfBlocks()); }
public void TestMoveLeft() { var shape = new ShapeT(new Point(2, 3)); shape.MoveLeft(); Assert.AreEqual(2, shape.Tiles[0].Position.X); Assert.AreEqual(2, shape.Tiles[1].Position.X); Assert.AreEqual(2, shape.Tiles[2].Position.X); Assert.AreEqual(1, shape.Tiles[3].Position.X); }