public void Specifying_an_event_activity() { _instance = new Instance(); _machine = new InstanceStateMachine(); _observer = new EventRaisedObserver <Instance>(); using (IDisposable subscription = _machine.ConnectEventObserver(_machine.Initialized, _observer)) _machine.RaiseEvent(_instance, x => x.Initialized).Wait(); }
public void Specifying_an_event_activity() { _instance = new Instance(); _machine = new InstanceStateMachine(); _observer = new StateChangeObserver <Instance>(); _eventObserver = new EventRaisedObserver <Instance>(); using (IDisposable subscription = _machine.ConnectStateObserver(_observer)) using (IDisposable beforeEnterSub = _machine.ConnectEventObserver(_machine.Initialized, _eventObserver)) using (IDisposable afterLeaveSub = _machine.ConnectEventObserver(_machine.LegCramped, _eventObserver)) { _machine.RaiseEvent(_instance, x => x.Initialized).Wait(); _machine.RaiseEvent(_instance, x => x.LegCramped).Wait(); _machine.RaiseEvent(_instance, x => x.Finish).Wait(); } }