public void Specifying_an_event_activity() { _instance = new Instance(); _machine = new InstanceStateMachine(); EventLift <Instance, Init> eventLift = _machine.CreateEventLift(_machine.Initialized); eventLift.Raise(_instance, new Init()).Wait(); }
public static Task Raise <TInstance, TData>(this EventLift <TInstance, TData> lift, TInstance instance, TData value, CancellationToken cancellationToken = default(CancellationToken)) where TInstance : class { var composer = new TaskComposer <TInstance>(cancellationToken); lift.Raise(composer, instance, value); return(composer.Finish()); }
public void Specifying_an_event_activity() { _instance = new Instance(); _machine = AutomatonymousStateMachine <Instance> .New(builder => builder .State("Running", out Running) .Event("Initialized", out Initialized) .During(builder.Initial) .When(Initialized, b => b.TransitionTo(Running)) ); EventLift <Instance> eventLift = _machine.CreateEventLift(Initialized); eventLift.Raise(_instance).Wait(); }
public static Task Raise <TInstance, TData>(this EventLift <TInstance, TData> lift, TInstance instance, TData value, CancellationToken cancellationToken = default) where TInstance : class { return(lift.Raise(instance, value, cancellationToken)); }