Exemple #1
0
        public async Task WhenIDeleteStreamInExpectedVersion(string streamId, ulong expectedVersion)
        {
            ScenarioContext.Current.SetStreamId(streamId);
            ScenarioContext.Current.SetExistingDocuments(await CosmosSetup.QueryAllDocuments(this.Context.Client, this.Context.Database, this.Context.Collection));

            await this.Context.EventStore.DeleteStream(ScenarioContext.Current.GetStreamId(), expectedVersion);
        }
        public async Task WhenIAppendEventsToStreamInExpectedVersion(int events, string streamId, ushort expectedVersion)
        {
            ScenarioContext.Current.SetStreamId(streamId);
            ScenarioContext.Current.SetNewEvents(TestSetup.GetEvents(events, expectedVersion + 1));
            ScenarioContext.Current.SetExistingDocuments(await CosmosSetup.QueryAllDocuments(this.Context.Client, this.Context.Database, this.Context.Collection));

            await this.Context.EventStore.WriteToStream(ScenarioContext.Current.GetStreamId(), ScenarioContext.Current.GetNewEvents(), expectedVersion, metadata : ScenarioContext.Current.GetHeaderMetadata());
        }
        public async Task WhenIWriteNewStreamWithEvents(string streamId, int events)
        {
            ScenarioContext.Current.SetStreamId(streamId);
            ScenarioContext.Current.SetNewEvents(TestSetup.GetEvents(events));
            ScenarioContext.Current.SetExistingDocuments(await CosmosSetup.QueryAllDocuments(this.Context.Client, this.Context.Database, this.Context.Collection));

            await this.Context.EventStore.WriteToStream(ScenarioContext.Current.GetStreamId(), ScenarioContext.Current.GetNewEvents(), metadata : ScenarioContext.Current.GetHeaderMetadata());
        }
        public async Task WhenIDeleteStreamInExpectedVersion(string streamId, ulong expectedVersion)
        {
            this.Context.StreamId          = streamId;
            this.Context.ExistingDocuments = await CosmosSetup.QueryAllDocuments(this.Context.Client, this.Context.Database, this.Context.Container);

            var response = await this.Context.EventStore.DeleteStream(streamId, expectedVersion);

            this.Context.Response = response;
        }
        public async Task WhenIAppendEventsToStreamInExpectedVersion(int events, string streamId, ushort expectedVersion)
        {
            this.Context.StreamId          = streamId;
            this.Context.NewEvents         = TestSetup.GetEvents(events, expectedVersion + 1);
            this.Context.ExistingDocuments = await CosmosSetup.QueryAllDocuments(this.Context.Client, this.Context.Database, this.Context.Container);

            var response = await this.Context.EventStore.WriteToStream(this.Context.StreamId, this.Context.NewEvents, expectedVersion, metadata : this.Context.HeaderMetadata);

            this.Context.Response = response;
        }
        public async Task WhenIWriteNewStreamWithEvents(string streamId, int events)
        {
            this.Context.StreamId          = streamId;
            this.Context.NewEvents         = TestSetup.GetEvents(events);
            this.Context.ExistingDocuments = await CosmosSetup.QueryAllDocuments(this.Context.Client, this.Context.Database, this.Context.Container);

            var response = await this.Context.EventStore.WriteToStream(this.Context.StreamId, this.Context.NewEvents, metadata : this.Context.HeaderMetadata);

            this.Context.Response = response;
        }