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