protected override async Task Given() { var lastEvent = await StreamsClient.ReadAllAsync(Direction.Backwards, Position.End, 1, userCredentials : TestCredentials.Root).FirstAsync(); LastCommitPosition = lastEvent.OriginalPosition?.CommitPosition ?? throw new Exception(); }
protected override async Task Given() { var events = await StreamsClient.ReadAllAsync(Direction.Forwards, Position.Start, 10, userCredentials : TestCredentials.Root).ToArrayAsync(); ExpectedEvent = events[events.Length / 2]; //just a random event in the middle of the results await Client.CreateToAllAsync(Group, new PersistentSubscriptionSettings(startFrom : ExpectedEvent.OriginalPosition), TestCredentials.Root); }
protected override async Task When() { await Client.CreateToAllAsync(Group, new PersistentSubscriptionSettings(), TestCredentials.Root); var lastEvent = await StreamsClient.ReadAllAsync(Direction.Backwards, Position.End, 1, userCredentials : TestCredentials.Root).FirstAsync(); LastCommitPosition = lastEvent.OriginalPosition?.CommitPosition ?? throw new Exception(); }
protected override async Task Given() { //append 10 events to random streams to make sure we have at least 10 events in the transaction file foreach (var @event in CreateTestEvents(10)) { await StreamsClient.AppendToStreamAsync(Guid.NewGuid().ToString(), StreamState.NoStream, new [] { @event }); } Events = await StreamsClient.ReadAllAsync(Direction.Forwards, Position.Start, 10, userCredentials : TestCredentials.Root).ToArrayAsync(); await Client.CreateToAllAsync(Group, new PersistentSubscriptionSettings(startFrom : Position.Start), TestCredentials.Root); }