Example #1
0
 public void visit(ShapeL lShape)
 {
     lShape.draw()[2].X--;
     lShape.draw()[2].Y++;
     lShape.draw()[3].X--;
     lShape.draw()[3].Y--;
     lShape.setPos(9);
     lShape.findHighestCell();
     lShape.findLowestCell();
 }
        public void TestMoveRight()
        {
            var shape = new ShapeL(new Point(2, 3));
            shape.MoveRight();

            Assert.AreEqual(5, shape.Tiles[0].Position.X);
            Assert.AreEqual(4, shape.Tiles[1].Position.X);
            Assert.AreEqual(3, shape.Tiles[2].Position.X);
            Assert.AreEqual(3, shape.Tiles[3].Position.X);
        }
Example #3
0
 public void visit(ShapeL lShape)
 {
     lShape.draw()[0].Y -= 2;
     lShape.draw()[1].X--;
     lShape.draw()[1].Y++;
     lShape.draw()[3].X++;
     lShape.draw()[3].Y--;
     lShape.setPos(6);
     lShape.findHighestCell();
     lShape.findLowestCell();
 }
Example #4
0
        public void ShapeL_Rotate_NoSpace()
        {
            //Initial position = a(5,0)b(6,0)c(4,0)d(4,1)
            Board  board              = new Board();
            ShapeL shapeTest          = new ShapeL(board);
            ShapeL shapeTest_expected = new ShapeL(board);
            String expected           = "(5, 0)(6, 0)(4, 0)(4, 1)";

            //Act

            shapeTest.Rotate();


            //Assert
            Assert.AreEqual(expected, shapeTest.getPositionOfBlocks());
        }
Example #5
0
        public void ShapeL_Rotate1_EnoughSpace()
        {
            //Initial position = a(5,0)b(6,0)c(4,0)d(4,1)
            //Move down = a(5,1)b(6,1)c(4,1)d(4,2)
            Board  board              = new Board();
            ShapeL shapeTest          = new ShapeL(board);
            ShapeL shapeTest_expected = new ShapeL(board);
            String expected           = "(5, 1)(5, 0)(5, 2)(6, 2)";

            //Act
            shapeTest.MoveDown();


            shapeTest.Rotate();

            //Assert
            Assert.AreEqual(expected, shapeTest.getPositionOfBlocks());
        }
Example #6
0
        public void ShapeL_Rotate2_EnoughSpace()
        {
            //a(5, 1)b(5, 2)c(5, 0)d(4, 0)

            Board  board              = new Board();
            ShapeL shapeTest          = new ShapeL(board);
            ShapeL shapeTest_expected = new ShapeL(board);
            String expected           = "(5, 1)(4, 1)(6, 1)(6, 0)";


            //Act
            shapeTest.MoveDown();
            shapeTest.Rotate();
            shapeTest.Rotate();


            //Assert
            Assert.AreEqual(expected, shapeTest.getPositionOfBlocks());
        }
Example #7
0
        public void ShapeI_Reset()
        {
            Board  board              = new Board();
            ShapeL shapeTest          = new ShapeL(board);
            ShapeL shapeTest_expected = new ShapeL(board);
            String expected           = "(5, 0)(6, 0)(4, 0)(4, 1)";

            //Act

            shapeTest.MoveDown();
            shapeTest.MoveDown();
            shapeTest.MoveLeft();
            shapeTest.MoveLeft();
            shapeTest.MoveLeft();
            shapeTest.Rotate();

            shapeTest.Reset();


            //Assert
            Assert.AreEqual(expected, shapeTest.getPositionOfBlocks());
        }
Example #8
0
        public void Rotate_ShapeL()
        {
            //arange
            IBoard board = new TestBoard(createEmptyBoard(10, 10));
            IShape shape = new ShapeL(board);

            //act
            Point[] arr = rotate(shape);

            //assert
            Assert.AreEqual(6, arr[0].X);             //expected, actual
            Assert.AreEqual(0, arr[0].Y);

            Assert.AreEqual(5, arr[1].X);
            Assert.AreEqual(1, arr[1].Y);

            Assert.AreEqual(6, arr[2].X);
            Assert.AreEqual(2, arr[2].Y);

            Assert.AreEqual(7, arr[3].X);
            Assert.AreEqual(1, arr[3].Y);
        }
Example #9
0
 public void visit(ShapeL lShape)
 {
     moveLeft(lShape);
 }
Example #10
0
 public void visit(ShapeL lShape)
 {
     moveRight(lShape);
 }