コード例 #1
0
        bool TryReadImmediateGiven(Event e, EventType type, out FlowCall.Given call)
        {
            call = null;

            var routes = type.GetRoutes(e).ToMany();

            if (routes.Contains(_topicKey) &&
                TryGetObservation(type, out var observation) &&
                observation.HasGiven(Event.IsScheduled(e)))
            {
                var point = new TimelinePoint(
                    _newPosition,
                    _cause,
                    type,
                    e.When,
                    Event.Traits.WhenOccurs.Get(e),
                    Event.Traits.EventId.Get(e),
                    Event.Traits.CommandId.Get(e),
                    Event.Traits.UserId.Get(e),
                    _topicKey,
                    routes,
                    () => e);

                call = new FlowCall.Given(point, observation);
            }

            return(call != null);
        }
コード例 #2
0
 public void CallGiven(Flow flow, FlowCall.Given call)
 {
     foreach (var givenMethod in Given.GetMethods(call.Point.Scheduled))
     {
         givenMethod.Call(flow, call.Point.Event);
     }
 }
コード例 #3
0
ファイル: TopicScope.cs プロジェクト: jmptrader/BlazorUI
        bool TryGetImmediateGiven(Event e, TimelinePosition position, out FlowCall.Given given)
        {
            given = null;

            if (TryGetObservation(e, out var observation))
            {
                var routes = observation.EventType.GetRoutes(e).ToMany();

                if (routes.Contains(Key))
                {
                    var point = new TimelinePoint(
                        position,
                        Point.Position,
                        observation.EventType,
                        e.When,
                        Event.Traits.WhenOccurs.Get(e),
                        Event.Traits.EventId.Get(e),
                        Event.Traits.CommandId.Get(e),
                        Event.Traits.UserId.Get(e),
                        Key,
                        routes,
                        () => e);

                    given = new FlowCall.Given(point, observation);
                }
            }

            return(given != null);
        }