Esempio n. 1
0
        public void RotationShouldBeZeroAfter270()
        {
            var shapeJ = new ShapeJ(5, 6, ShapeRotation.TwoSeventy);

            shapeJ.Rotate();
            shapeJ.Rotation.Should().Be(ShapeRotation.Zero);
        }
        public void TestMoveRight()
        {
            var shape = new ShapeJ(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);
        }
Esempio n. 3
0
        public void ShapeJ_Rotate_NoSpace()
        {
            //Initial position = a(5,0)b(6,0)c(4,0)d(4,1)
            Board  board              = new Board();
            ShapeJ shapeTest          = new ShapeJ(board);
            ShapeJ shapeTest_expected = new ShapeJ(board);
            String expected           = "(5, 0)(6, 0)(4, 0)(6, 1)";

            //Act
            shapeTest.Rotate();

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

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

            //Assert
            Assert.AreEqual(expected, shapeTest.getPositionOfBlocks());
        }
Esempio n. 5
0
        public void ShapeJ_Rotate2_EnoughSpace()
        {
            //a(5, 1)b(5, 2)c(5, 0)d(4, 2)

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


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


            //Assert
            Assert.AreEqual(expected, shapeTest.getPositionOfBlocks());
        }
Esempio n. 6
0
        public void ShapeJ_Reset()
        {
            Board  board              = new Board();
            ShapeJ shapeTest          = new ShapeJ(board);
            ShapeJ shapeTest_expected = new ShapeJ(board);
            String expected           = "(5, 0)(6, 0)(4, 0)(6, 1)";

            //Act

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


            //Assert
            Assert.AreEqual(expected, shapeTest.getPositionOfBlocks());
        }
Esempio n. 7
0
        public void Rotate_ShapeJ()
        {
            //arange
            IBoard board = new TestBoard(createEmptyBoard(10, 10));
            IShape shape = new ShapeJ(board);

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

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

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

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

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