/// <summary> /// Initializes a new instance. /// </summary> /// <param name="activity"></param> public TwilioTestContext(Activity activity) { // wrap in CallScope var arg1 = new DelegateInArgument <CallContext>(); var scope = new CallScope() { Body = new ActivityAction <CallContext>() { Argument = arg1, Handler = activity, }, }; // workflow needs a sync context to run on sync = new SynchronizedSynchronizationContext(); // new invoker which uses ourself as the context app = new WorkflowApplication(scope); app.Extensions.Add <ITwilioContext>(() => this); app.Completed = a => state = a.CompletionState; response = new XElement("Response"); element = response; }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="activity"></param> public TwilioTestContext(Activity activity) { // wrap in CallScope var arg1 = new DelegateInArgument<CallContext>(); var scope = new CallScope() { Body = new ActivityAction<CallContext>() { Argument = arg1, Handler = activity, }, }; // workflow needs a sync context to run on sync = new SynchronizedSynchronizationContext(); // new invoker which uses ourself as the context app = new WorkflowApplication(scope); app.Extensions.Add<ITwilioContext>(() => this); app.Completed = a => state = a.CompletionState; response = new XElement("Response"); element = response; }