public void ShapeZ_Rotate_NoSpace() { IBoard board = new Board(); ShapeZ shapeTest = new ShapeZ(board); ShapeZ shapeTest_expected = new ShapeZ(board); String expected = "(5, 0)(4, 0)(5, 1)(6, 1)"; /* first row of the board * Initial position * * [ ][ ][ ][ ][b][a][ ][ ][ ][ ] * [ ][ ][ ][ ][ ][c][d][ ][ ][ ] * [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] * [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] */ //Act shapeTest.Rotate(); /* Should look like this after attempting to rotate * * [ ][ ][ ][ ][b][a][ ][ ][ ][ ] * [ ][ ][ ][ ][ ][c][d][ ][ ][ ] * [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] * [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] */ Assert.AreEqual(expected, shapeTest.getPositionOfBlocks()); }
public void ShapeZ_rotate2_EnoughSpace() { IBoard board = new Board(); ShapeZ shapeTest = new ShapeZ(board); ShapeZ shapeTest_expected = new ShapeZ(board); String expected = "(5, 1)(4, 1)(5, 2)(6, 2)"; /* first row of the board * Initial position * * [ ][ ][ ][ ][b][a][ ][ ][ ][ ] * [ ][ ][ ][ ][ ][c][d][ ][ ][ ] * [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] * [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] */ shapeTest.MoveDown(); shapeTest.Rotate(); shapeTest.Rotate(); /* Should look like this after rotating once * * [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] * [ ][ ][ ][ ][b][a][ ][ ][ ][ ] * [ ][ ][ ][ ][ ][c][d][ ][ ][ ] * [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] * */ Assert.AreEqual(expected, shapeTest.getPositionOfBlocks()); }
public void TestMoveRight() { var shape = new ShapeZ(new Point(2, 3)); shape.MoveRight(); Assert.AreEqual(3, shape.Tiles[0].Position.X); Assert.AreEqual(4, shape.Tiles[1].Position.X); Assert.AreEqual(4, shape.Tiles[2].Position.X); Assert.AreEqual(5, shape.Tiles[3].Position.X); }
public void visit(ShapeZ zShape) { zShape.draw()[0].X -= 2; zShape.draw()[1].X--; zShape.draw()[1].Y++; zShape.draw()[3].X++; zShape.draw()[3].Y++; zShape.setPos(12); zShape.findLowestCell(); zShape.findHighestCell(); }
//test with shapeZ to verify multi-line shapes public void MoveRight_NoSpace_EmptyBoard() { //arange IBoard board = new TestBoard(createEmptyBoard(8, 10)); IShape shape = new ShapeZ(board); //act shape.MoveRight(); int x = shape[0].Position.X; int y = shape[0].Position.Y; //assert Assert.AreEqual(5, x); //expected, actual Assert.AreEqual(0, y); }
//test with shapeZ to verify multi-line shapes public void MoveRight_NoSpace_BoardWithLine() { //arange IBoard board = new TestBoard (createBoardWithLineVert(8, -1, (i => i >= 0))); IShape shape = new ShapeZ(board); //act shape.MoveRight(); int x = shape[0].Position.X; int y = shape[0].Position.Y; //assert Assert.AreEqual(5, x); //expected, actual Assert.AreEqual(0, y); }
public void Rotate_ShapeZ() { //arange IBoard board = new TestBoard(createEmptyBoard(10, 10)); IShape shape = new ShapeZ(board); //act shape.MoveDown(); shape.Rotate(); int x1 = shape[0].Position.X; int y1 = shape[0].Position.Y; shape.Rotate(); int x2 = shape[0].Position.X; int y2 = shape[0].Position.Y; //assert Assert.AreEqual(6, x1); //expected, actual Assert.AreEqual(2, y1); Assert.AreEqual(5, x2); //expected, actual Assert.AreEqual(1, y2); }
public void ShapeZ_Reset() { IBoard board = new Board(); ShapeZ shapeTest = new ShapeZ(board); ShapeZ shapeTest_expected = new ShapeZ(board); String expected = "(5, 0)(4, 0)(5, 1)(6, 1)"; /* first row of the board * Initial position * * [ ][ ][ ][ ][b][a][ ][ ][ ][ ] * [ ][ ][ ][ ][ ][c][d][ ][ ][ ] * [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] * [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] */ //Act shapeTest.MoveDown(); shapeTest.MoveDown(); shapeTest.MoveLeft(); shapeTest.MoveLeft(); shapeTest.MoveLeft(); shapeTest.Rotate(); /* Should look like this after reset. * [ ][ ][ ][ ][b][a][ ][ ][ ][ ] * [ ][ ][ ][ ][ ][c][d][ ][ ][ ] * [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] * [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] */ shapeTest.Reset(); //Assert Assert.AreEqual(expected, shapeTest.getPositionOfBlocks()); }
public void visit(ShapeZ zShape) { moveLeft(zShape); }
public void visit(ShapeZ zShape) { moveRight(zShape); }