public IScenarioWithEndpointBehavior <TContext> Done(Func <TContext, bool> doneCriteria = null)
        {
            var behavior = new ServiceControlClient <TContext>(context => sequence.Continue(context));

            return(endpointBehavior.WithComponent(behavior).Done(ctx => sequence.IsFinished(ctx) && (doneCriteria == null || doneCriteria(ctx))));
        }
        public static IScenarioWithEndpointBehavior <TContext> Done <TContext>(this IScenarioWithEndpointBehavior <TContext> endpointBehavior, Func <TContext, Task <bool> > func) where TContext : ScenarioContext
        {
            var behavior = new ServiceControlClient <TContext>(func);

            return(endpointBehavior.WithComponent(behavior).Done(ctx => behavior.Done));
        }