예제 #1
0
        public void TestDeployShape()
        {
            ShapeProxy a = createInstance();

            //test Shape returns not nulls and valid shapes

            var shape = a.DeployNewShape();

            for (int i = 0; i < 5; i++)
            {
                Assert.AreEqual(true, testValidShape(shape));
                shape = a.DeployNewShape();
            }
        }
예제 #2
0
        public void DeployNewShape_WithArgument()
        {
            //arange
            IBoard     board  = new TestBoard(createEmptyBoard());
            ShapeProxy shape  = new ShapeProxy(board);
            ShapeProxy shape2 = new ShapeProxy(board);

            //act
            shape.DeployNewShape(shape2);

            //assert
            //Blocks should have the same color since the shape created in shape2 is passed to shape
            Assert.IsTrue(shape[0].Colour.Equals(shape2[0].Colour));
        }
예제 #3
0
        public void DeployNewShape_DifferentShapeCreated()
        {
            //arange
            IBoard     board = new TestBoard(createEmptyBoard());
            ShapeProxy shape = new ShapeProxy(board);

            //act
            shape.Drop();
            Block b1 = shape[0];

            shape.DeployNewShape();
            Block b2 = shape[0];

            //assert
            //Blocks should have different positions since belong two different shapes (and one of the was moved)
            Assert.IsFalse(b1.Position.Equals(b2.Position));
        }