예제 #1
0
        public void MoveRotateProxyTest()
        {
            ShapeProxy b = createInstance();

            b.MoveDown();
            b.MoveDown();
            b.MoveDown();

            String beforeRotate = b.ToString();

            b.Rotate();
            Console.WriteLine(b.ToString() + "before Rotate\n" + beforeRotate);

            //back to inital state

            //if shape is an O no rotation is available
            if (boardInstance.Shape is ShapeO)
            {
                Assert.AreEqual(beforeRotate, b.ToString());
            }
            else
            {
                Assert.AreNotEqual(beforeRotate, b.ToString());
            }
        }
예제 #2
0
        public void MoveResetProxyTest()
        {
            ShapeProxy b = createInstance();

            b.MoveDown();
            String beforeReset = b.ToString();

            //two places down

            //move down once
            //act
            b.Reset();

            String afterReset = b.ToString();

            Console.WriteLine("Coors should be different" + "Before Reset" + beforeReset + "\nAfter Reset" + afterReset);

            Assert.AreNotEqual(beforeReset, afterReset);
        }
예제 #3
0
        public void MoveRightProxyTest()
        {
            ShapeProxy b = createInstance();

            Shape a = boardInstance.Shape as Shape;

            //two places down
            for (int i = 0; i < 2; i++)
            {
                //move down once
                String expect = calDownLeftOrRight(a, 1, 0);

                //act
                b.MoveRight();

                a.DrawShape();
                Console.WriteLine("Expected is \n" + expect + "\n" + "Obtained is \n" + a.ToString());

                Assert.AreEqual(expect, b.ToString());
            }
        }
예제 #4
0
        public void DropProxyTest()
        {
            ShapeProxy b = createInstance();

            bool bottomLineFilled = false;

            //to avoid clearlines if ShapeI spawns
            boardInstance.board[19, 0] = Color.Transparent;

            //two places down
            Console.WriteLine("Board before drop\n");
            UtilityClass.DrawFakeBoardContents(boardInstance);
            //move down once
            //act
            b.Drop();

            String afterDrop = b.ToString();

            Console.WriteLine("board After drop\n");


            UtilityClass.DrawFakeBoardContents(boardInstance);

            if (boardInstance[19, 3] != Color.Transparent ||
                boardInstance[19, 4] != Color.Transparent ||
                boardInstance[19, 5] != Color.Transparent ||
                boardInstance[19, 6] != Color.Transparent)
            {
                bottomLineFilled = true;
            }
            else
            {
                bottomLineFilled = false;
            }

            Assert.AreEqual(true, bottomLineFilled);
        }