예제 #1
0
        public void ShapeI_MoveRight_NoSpace()
        {
            Board  board              = new Board();
            ShapeI shapeTest          = new ShapeI(board);
            ShapeI shapeTest_expected = new ShapeI(board);
            String expected           = "(8, 0)(9, 0)(7, 0)(6, 0)";


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


            //Act
            shapeTest.MoveRight();
            shapeTest.MoveRight();
            shapeTest.MoveRight();

            /*
             *  Move the piece three times to the Right to put it near the Right border
             *  [ ][ ][ ][ ][ ][ ][d][c][a][b]
             *
             */

            //Now move once more to check if it goes outside the board
            shapeTest.MoveRight();


            //Assert
            Assert.AreEqual(expected, shapeTest.getPositionOfBlocks());
        }
예제 #2
0
        public void TestMoveRight()
        {
            var shape = new ShapeI(new Point(2, 3));
            shape.MoveRight();

            Assert.AreEqual(3, shape.Tiles[0].Position.X);
            Assert.AreEqual(4, shape.Tiles[1].Position.X);
            Assert.AreEqual(5, shape.Tiles[2].Position.X);
            Assert.AreEqual(6, shape.Tiles[3].Position.X);
        }
예제 #3
0
        public void MoveRight_EnoughSpace_EmptyBoard()
        {
            //arange
            IBoard board = new TestBoard(createEmptyBoard(10, 10));
            IShape shape = new ShapeI(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);
        }
예제 #4
0
        public void ShapeI_MoveRight_EnoughSpace()
        {
            Board  board              = new Board();
            ShapeI shapeTest          = new ShapeI(board);
            ShapeI shapeTest_expected = new ShapeI(board);
            String expected           = "(6, 0)(7, 0)(5, 0)(4, 0)";

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

            //Act
            shapeTest.MoveRight();

            /*      AFter moving one to the right
             * [ ][ ][ ][ ][d][c][a][b][ ][ ]
             *
             */
            //Assert
            Assert.AreEqual(expected, shapeTest.getPositionOfBlocks());
        }