public async Task StreamRevisionWorksSameForTcpAndHttp() { EventStoreFacade f = ConnectEs(); Guid g = Guid.NewGuid(); string sm = $"test-{g}"; List <ResolvedEvent> events_1 = new List <ResolvedEvent>(); List <ResolvedEvent> events_2 = new List <ResolvedEvent>(); StreamRevision sr = new StreamRevision(1); await f.AppendToStreamAsync(sm, AnyStreamRevision.Any, TestEvents(new RoomAdded(), new RoomAdded())); await foreach (var i in f.ReadStreamAsync(Direction.Forwards, sm, StreamRevision.Start, 2)) { events_1.Add(i); } f.IsTcp = !f.IsTcp; await foreach (var i in f.ReadStreamAsync(Direction.Forwards, sm, StreamRevision.Start, 2)) { events_2.Add(i); } for (int i = 0; i < 2; i++) { var e1 = events_1[i]; var e2 = events_2[i]; e1.OriginalEventNumber.Should().Be(e2.OriginalEventNumber); } }
public async Task SubscribeFromStart() { EventStoreFacade f = ConnectEs(); Guid g = Guid.NewGuid(); string sm = $"test-{g}"; List <ResolvedEvent> events = new List <ResolvedEvent>(); StreamRevision sr = new StreamRevision(0); await f.SubscribeToStreamAsync(sm, sr, async (s, r, c) => { events.Add(r); }, null, true); await f.AppendToStreamAsync(sm, AnyStreamRevision.Any, TestEvents(new RoomAdded())); await Task.Delay(1000); events.Should().HaveCount(1); }