public async Task Projections_can_be_built_from_whole_event_streams_on_demand() { var projector = AccountBalanceProjector(); var balanceProjection = await stream.Aggregate(projector); balanceProjection.Balance.Should().Be(11.11m); }
public static ISingleStream <Dictionary <string, List <TraceEvent> > > KeepLastTracesPerNode(this IStream <TraceEvent> traceEventStream, int limit = 100) { return(traceEventStream.Aggregate("aggregate traces per node type", i => new LimitedQueue <TraceEvent>(limit), i => i.NodeName, (a, e) => { a.Enqueue(e); return a; }) .Aggregate("Join all aggregations", i => new Dictionary <string, List <TraceEvent> >(), i => true, (a, l) => { a[l.Key] = l.Aggregation.ToList(); return a; }) .Select("create aggregation result", i => i.Aggregation) .First("get single aggregation result")); }