Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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;
            }
        }
Esempio n. 4
0
 public Given(TimelinePoint point, FlowObservation observation) : base(point, observation)
 {
 }
Esempio n. 5
0
 internal FlowCall(TimelinePoint point, FlowObservation observation)
 {
     Point       = point;
     Observation = observation;
 }
Esempio n. 6
0
 bool TryGetObservation(Event e, out FlowObservation observation) =>
 Key.Type.Observations.TryGet(e, out observation) &&
 observation.HasGiven(Event.IsScheduled(e));