public new void When() { _distributionCorrelationId = Guid.NewGuid(); _fakeTimeProvider = new FakeTimeProvider(); var fromPositions = new Dictionary <string, long>(); fromPositions.Add("$et-eventTypeOne", 0); fromPositions.Add("$et-eventTypeTwo", 0); _eventReader = new EventByTypeIndexEventReader(_bus, _distributionCorrelationId, null, new string[] { "eventTypeOne", "eventTypeTwo" }, false, new TFPos(0, 0), fromPositions, true, _fakeTimeProvider, stopOnEof: true); _eventReader.Resume(); _eventTypeOneStreamReadCorrelationId = TimeoutRead("$et-eventTypeOne", Guid.Empty); CompleteForwardStreamRead("$et-eventTypeOne", _eventTypeOneStreamReadCorrelationId, new[] { ResolvedEvent.ForUnresolvedEvent( new EventRecord( 1, 50, Guid.NewGuid(), Guid.NewGuid(), 50, 0, "$et-eventTypeOne", ExpectedVersion.Any, DateTime.UtcNow, PrepareFlags.SingleWrite | PrepareFlags.TransactionBegin | PrepareFlags.TransactionEnd | PrepareFlags.IsJson, "$>", Helper.UTF8NoBom.GetBytes("0@test-stream"), Helper.UTF8NoBom.GetBytes(TFPosToMetadata(new TFPos(50, 50))))), ResolvedEvent.ForUnresolvedEvent( new EventRecord( 2, 150, Guid.NewGuid(), Guid.NewGuid(), 150, 0, "$et-eventTypeOne", ExpectedVersion.Any, DateTime.UtcNow, PrepareFlags.SingleWrite | PrepareFlags.TransactionBegin | PrepareFlags.TransactionEnd, "$>", Helper.UTF8NoBom.GetBytes("1@test-stream"), Helper.UTF8NoBom.GetBytes(TFPosToMetadata(new TFPos(150, 150))))) }); _eventTypeTwoStreamReadCorrelationId = TimeoutRead("$et-eventTypeTwo", Guid.Empty); CompleteForwardStreamRead("$et-eventTypeTwo", _eventTypeTwoStreamReadCorrelationId, new[] { ResolvedEvent.ForUnresolvedEvent( new EventRecord( 1, 100, Guid.NewGuid(), Guid.NewGuid(), 100, 0, "$et-eventTypeTwo", ExpectedVersion.Any, DateTime.UtcNow, PrepareFlags.SingleWrite | PrepareFlags.TransactionBegin | PrepareFlags.TransactionEnd | PrepareFlags.IsJson, "$>", Helper.UTF8NoBom.GetBytes("2@test-stream"), Helper.UTF8NoBom.GetBytes(TFPosToMetadata(new TFPos(100, 100))))), ResolvedEvent.ForUnresolvedEvent( new EventRecord( 2, 200, Guid.NewGuid(), Guid.NewGuid(), 200, 0, "$et-eventTypeTwo", ExpectedVersion.Any, DateTime.UtcNow, PrepareFlags.SingleWrite | PrepareFlags.TransactionBegin | PrepareFlags.TransactionEnd, "$>", Helper.UTF8NoBom.GetBytes("3@test-stream"), Helper.UTF8NoBom.GetBytes(TFPosToMetadata(new TFPos(200, 200))))) }); }
public new void When() { _distributionCorrelationId = Guid.NewGuid(); _fakeTimeProvider = new FakeTimeProvider(); var fromPositions = new Dictionary <string, long>(); fromPositions.Add("$et-eventTypeOne", 0); fromPositions.Add("$et-eventTypeTwo", 0); _eventReader = new EventByTypeIndexEventReader(_bus, _distributionCorrelationId, null, new string[] { "eventTypeOne", "eventTypeTwo" }, false, new TFPos(0, 0), fromPositions, true, _fakeTimeProvider, stopOnEof: true); _eventReader.Resume(); CompleteForwardStreamRead("$et-eventTypeOne", Guid.Empty); CompleteForwardStreamRead("$et-eventTypeTwo", Guid.Empty); CompleteBackwardStreamRead("$et", Guid.Empty); var correlationId = CompleteForwardAllStreamRead(Guid.Empty, new[] { EventStore.Core.Data.ResolvedEvent.ForUnresolvedEvent( new EventRecord( 1, 50, Guid.NewGuid(), Guid.NewGuid(), 50, 0, "test_stream", ExpectedVersion.Any, _fakeTimeProvider.Now, PrepareFlags.SingleWrite | PrepareFlags.TransactionBegin | PrepareFlags.TransactionEnd, "eventTypeOne", new byte[] { 1 }, new byte[] { 2 }), 100), EventStore.Core.Data.ResolvedEvent.ForUnresolvedEvent( new EventRecord( 2, 150, Guid.NewGuid(), Guid.NewGuid(), 150, 0, "test_stream", ExpectedVersion.Any, _fakeTimeProvider.Now, PrepareFlags.SingleWrite | PrepareFlags.TransactionBegin | PrepareFlags.TransactionEnd, "eventTypeTwo", new byte[] { 1 }, new byte[] { 2 }), 200), }); TimeoutRead("$all", correlationId); }