Beispiel #1
0
        public void VerifyBallShouldBounceFromTwoHorizontalBricks()
        {
            var bricks = CreateBricks(0, 0);

            ball.Boundary.Min = new Vector2(45, 20);

            ICollisionCommand command = new BrickCollisionCommand(bricks, levelManagerMock.Object, null, manager, collisionState);

            command.Detect(ball);

            Assert.AreEqual(2, collisionState.BricksHitList.Count);
            Assert.IsTrue(collisionState.CollisionWithBrick);
            Assert.IsTrue(collisionState.BounceFromBrick);
        }
Beispiel #2
0
        public void VerifyBallShouldNOTBounceFromOneBrick()
        {
            var bricks = CreateBricks(0, 0);

            ball.Boundary.Min = new Vector2(0, 50);

            ICollisionCommand command = new BrickCollisionCommand(bricks, levelManagerMock.Object, null, manager, collisionState);

            command.Detect(ball);

            Assert.AreEqual(0, collisionState.BricksHitList.Count);
            Assert.IsFalse(collisionState.CollisionWithBrick);
            Assert.IsFalse(collisionState.BounceFromBrick);
        }