Пример #1
0
        public void TestMoveLeft()
        {
            var shape = new ShapeS(new Point(2, 3));
            shape.MoveLeft();

            Assert.AreEqual(1, shape.Tiles[0].Position.X);
            Assert.AreEqual(2, shape.Tiles[1].Position.X);
            Assert.AreEqual(2, shape.Tiles[2].Position.X);
            Assert.AreEqual(3, shape.Tiles[3].Position.X);
        }
Пример #2
0
        public void ShapeS_Reset()
        {
            IBoard board              = new Board();
            ShapeS shapeTest          = new ShapeS(board);
            ShapeS shapeTest_expected = new ShapeS(board);
            String expected           = "(5, 0)(6, 0)(4, 1)(5, 1)";

            /*      first row of the board
             *          Initial position
             *
             * [ ][ ][ ][ ][ ][a][b][ ][ ][ ]
             * [ ][ ][ ][ ][c][d][ ][ ][ ][ ]
             * [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
             * [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
             */

            //Act

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

            /*     Should look like this after reset.
             * [ ][ ][ ][ ][ ][a][b][ ][ ][ ]
             * [ ][ ][ ][ ][c][d][ ][ ][ ][ ]
             * [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
             * [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
             *
             */

            shapeTest.Reset();
            //Assert
            Assert.AreEqual(expected, shapeTest.getPositionOfBlocks());
        }