async Task ObserveNextPoint() { try { Point = await DequeueNextPoint(); Observation = GetPointObservation(); StartFlowIfFirst(); if (Running && Flow != null) { await ObservePoint(); CheckDone(); } } catch (Exception error) { await Stop(error); } finally { Point = null; Observation = null; } }
bool TryRouteEvent() { var hasRoute = _routesByEvent.TryGetValue(_event, out var route); if (!_givensByEvent.TryGetValue(_event, out var given)) { given = new FlowMethodSet <FlowGiven>(); } FlowObservation observation; if (!_flow.IsTopic) { observation = new FlowObservation(_flow, _event, route, given); } else { if (!_whensByEvent.TryGetValue(_event, out var when)) { when = new FlowMethodSet <TopicWhen>(); } observation = new TopicObservation(_flow, _event, route, given, when); } _flow.Observations.Declare(observation); _event.Observations.Write.Add(observation); return(hasRoute); }
async Task ObserveNextPoint() { try { Point = await _queue.Dequeue(); Observation = Key.Type.Observations.Get(Point.Type); if (PointIsAfterCheckpoint) { await ObservePointIfStarted(); } } catch (Exception error) { await Stop(error); } finally { Point = null; Observation = null; } }
public Given(TimelinePoint point, FlowObservation observation) : base(point, observation) { }
internal FlowCall(TimelinePoint point, FlowObservation observation) { Point = point; Observation = observation; }
bool TryGetObservation(Event e, out FlowObservation observation) => Key.Type.Observations.TryGet(e, out observation) && observation.HasGiven(Event.IsScheduled(e));