Example #1
0
        internal async Task <TimelinePoint> WriteFromApp(Event e)
        {
            var eventType = _area.Events[e.GetType()];

            _queryType.ExpectObserves(eventType);

            _currentPosition = _currentPosition.Next();

            var point = new TimelinePoint(
                _currentPosition,
                TimelinePosition.None,
                eventType,
                e.When,
                Event.Traits.WhenOccurs.Get(e),
                Event.Traits.EventId.Get(e),
                Event.Traits.CommandId.Get(e),
                Event.Traits.UserId.Get(e),
                null,
                eventType.GetRoutes(e, Event.IsScheduled(e)).ToMany(),
                () => e);

            await _observer.OnNext(point);

            return(point);
        }
Example #2
0
        IEnumerable <FlowCall.Given> GetImmediateGivens(Many <Event> newEvents, TimelinePosition newPosition)
        {
            foreach (var e in newEvents)
            {
                if (TryGetImmediateGiven(e, newPosition, out var given))
                {
                    yield return(given);
                }

                newPosition = newPosition.Next();
            }
        }
        IEnumerable <FlowCall.Given> ReadImmediateGivenCalls()
        {
            for (var i = 0; i < _newEvents.Count; i++)
            {
                var e    = _newEvents[i];
                var type = _newEventTypes[i];

                if (TryReadImmediateGiven(e, type, out var call))
                {
                    yield return(call);
                }

                _newPosition = _newPosition.Next();
            }
        }