-
-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
See this lifted from Marten:
public class multi_stream_projections: DaemonContext
{
public multi_stream_projections(ITestOutputHelper output): base(output)
{
}
[Fact]
public void lifecycle_is_async_by_default()
{
new DayProjection().Lifecycle.ShouldBe(ProjectionLifecycle.Async);
}
[Fact]
public async Task splicing_events()
{
NumberOfStreams = 10;
await PublishMultiThreaded(3);
var allEvents = await theSession.Events.QueryAllRawEvents().ToListAsync();
var slicer = new DayProjection().Slicer;
var slices = await slicer.SliceAsyncEvents(theSession, allEvents.ToList());
foreach (var slice in slices.SelectMany(x => x.Slices).ToArray())
{
var events = slice.Events();
events.All(x => x.Data is IDayEvent || x.Data is Movement || x.Data is Stop).ShouldBeTrue();
events.Select(x => x.Data).OfType<IDayEvent>().All(x => x.Day == slice.Id)
.ShouldBeTrue();
var travels = events.OfType<Event<Travel>>().ToArray();
foreach (var travel in travels)
{
var index = events.As<List<IEvent>>().IndexOf(travel);
for (var i = 0; i < travel.Data.Stops.Count; i++)
{
events.ElementAt(index + i + 1).Data.ShouldBeSameAs(travel.Data.Stops[i]);
}
}
}
slices.ShouldNotBeNull();
}
Metadata
Metadata
Assignees
Labels
No labels