Пример #1
0
        public void MoveDown_EnoughSpace()
        {
            //arange
            IBoard board = new TestBoard(createEmptyBoard());
            IShape shape = new ShapeProxy(board);

            //act
            int x1 = shape[0].Position.X;
            int y1 = shape[0].Position.Y;

            shape.MoveDown();
            int x2 = shape[0].Position.X;
            int y2 = shape[0].Position.Y;

            //assert
            Assert.IsTrue(x1 == x2);
            Assert.IsTrue(y1 != y2);
        }
Пример #2
0
        public void MoveLeft_NoSpace_EmptyBoard()
        {
            //arange
            IBoard board = new TestBoard(createEmptyBoard(10, 1));
            IShape shape = new ShapeI(board);

            //act
            shape.MoveLeft();
            shape.MoveLeft();
            shape.MoveLeft();
            shape.MoveLeft();
            shape.MoveLeft();
            int x = shape[0].Position.X;
            int y = shape[0].Position.Y;

            //assert
            Assert.AreEqual(0, x);             //expected, actual
            Assert.AreEqual(0, y);
        }
Пример #3
0
        public void LineCheck()
        {
            TestBoard board = new TestBoard();

            int lines = 4;

            for (int i = 0; i < lines; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    board[i + 2, j] = Color.Blue;
                }
            }

            int clearedLines = board.lineCheck();

            Console.WriteLine();
            Assert.AreEqual(clearedLines, lines);
        }
Пример #4
0
        public void Rotate_ShapeT()
        {
            //arange
            IBoard board = new TestBoard(createEmptyBoard(10, 10));
            IShape shape = new ShapeT(board);

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

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

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

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

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