diff --git a/.editorconfig b/.editorconfig index e29d688..077e23c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -17,3 +17,6 @@ trim_trailing_whitespace = false [*.ps1] end_of_line = lf + +[*.{yml,yaml}] +indent_size = 2 diff --git a/.github/workflows/build-on-push.yml b/.github/workflows/build-on-push.yml index b0ef17a..fb1b3cf 100644 --- a/.github/workflows/build-on-push.yml +++ b/.github/workflows/build-on-push.yml @@ -2,15 +2,14 @@ name: Build ON push on: push: - branches: [ master, main ] + branches: [master, main] jobs: - build: runs-on: ubuntu-latest steps: - name: Run ESDB image - run: docker run -d --name esdbnode -it -p 2113:2113 -p 1113:1113 eventstore/eventstore:latest --insecure --run-projections=All + run: docker run -d --name esdbnode -it -p 2113:2113 -p 1113:1113 eventstore/eventstore:latest --insecure --run-projections=All --enable-atom-pub-over-http - name: Checkout uses: actions/checkout@v2 - name: Setup .NET @@ -28,4 +27,3 @@ jobs: - name: Test run: dotnet test --no-build --verbosity minimal working-directory: ./src - diff --git a/src/BullOak.Repositories.EventStore.Test.Integration/BullOak.Repositories.EventStore.Test.Integration.csproj b/src/BullOak.Repositories.EventStore.Test.Integration/BullOak.Repositories.EventStore.Test.Integration.csproj index 2dc4483..a780d30 100644 --- a/src/BullOak.Repositories.EventStore.Test.Integration/BullOak.Repositories.EventStore.Test.Integration.csproj +++ b/src/BullOak.Repositories.EventStore.Test.Integration/BullOak.Repositories.EventStore.Test.Integration.csproj @@ -37,13 +37,4 @@ - - - Always - - - Always - - - diff --git a/src/BullOak.Repositories.EventStore.Test.Integration/Contexts/EventStoreIntegrationContext.cs b/src/BullOak.Repositories.EventStore.Test.Integration/Contexts/EventStoreIntegrationContext.cs index 928d523..65f0fcf 100644 --- a/src/BullOak.Repositories.EventStore.Test.Integration/Contexts/EventStoreIntegrationContext.cs +++ b/src/BullOak.Repositories.EventStore.Test.Integration/Contexts/EventStoreIntegrationContext.cs @@ -1,5 +1,4 @@ using EventStore.Client; -using EventStore.Client.Projections; namespace BullOak.Repositories.EventStore.Test.Integration.Contexts { @@ -14,6 +13,8 @@ namespace BullOak.Repositories.EventStore.Test.Integration.Contexts using System.Threading.Tasks; using Events; using TechTalk.SpecFlow; + using Polly; + using FluentAssertions; internal class EventStoreIntegrationContext { @@ -85,33 +86,129 @@ public async Task AppendEventsToCurrentStream(string id, IMyEvent[] events) } } + public async Task TruncateStream(string id) + { + var connection = GetConnection(); + + var lastEventResult = connection.ReadStreamAsync(Direction.Backwards, id, StreamPosition.End, 1); + ResolvedEvent lastEvent = default; + await foreach (var e in lastEventResult) + { + lastEvent = e; + break; + } + + if (lastEvent.OriginalEventNumber >= 0) + { + var metadata = await connection.GetStreamMetadataAsync(id); + + await connection.SetStreamMetadataAsync( + id, + metadata.MetastreamRevision.HasValue + ? new StreamRevision(metadata.MetastreamRevision.Value) + : StreamRevision.None, + new StreamMetadata(truncateBefore: lastEvent.OriginalEventNumber + 1)); + } + } + + public async Task AssertStreamHasNoResolvedEvents(string id) + { + var retry = Policy + .HandleResult(true) + .WaitAndRetryAsync(3, count => TimeSpan.FromMilliseconds(500)); + + var anyResolvedEvents = await retry.ExecuteAsync(async () => + { + var connection = GetConnection(); + var result = connection.ReadStreamAsync( + Direction.Forwards, + id, + revision: StreamPosition.Start, + resolveLinkTos: true); + var eventFound = false; + + await foreach (var x in result) + { + if (x.IsResolved) + { + eventFound = true; + break; + } + } + return eventFound; + }); + + + anyResolvedEvents.Should().BeFalse(); + } + + public async Task AssertStreamHasSomeUnresolvedEvents(string id) + { + var retry = Policy + .HandleResult(false) + .WaitAndRetryAsync(3, count => TimeSpan.FromMilliseconds(500)); + + var anyUnresolvedEvents = await retry.ExecuteAsync(async () => + { + try + { + var connection = GetConnection(); + var result = connection.ReadStreamAsync( + Direction.Forwards, + id, + revision: StreamPosition.Start, + resolveLinkTos: true); + var eventFound = false; + + await foreach (var x in result) + { + if (!x.IsResolved) + { + eventFound = true; + break; + } + } + + return eventFound; + } + catch (StreamNotFoundException) + { + return false; + } + }); + + + anyUnresolvedEvents.Should().BeTrue(); + } + public Task SoftDeleteStream(string id) - => repository.SoftDelete(id); + => GetConnection().SoftDeleteAsync(id, StreamState.Any); public Task HardDeleteStream(string id) => GetConnection().TombstoneAsync(id, StreamState.Any); - public Task SoftDeleteByEvent(string id) + public Task SoftDeleteStreamFromRepository(string id) + => repository.SoftDelete(id); + public Task SoftDeleteFromRepositoryBySoftDeleteEvent(string id) => repository.SoftDeleteByEvent(id); - public Task SoftDeleteByEvent(string id, Func createSoftDeleteEvent) + public Task SoftDeleteFromRepositoryBySoftDeleteEvent(string id, Func createSoftDeleteEvent) where TSoftDeleteEvent : EntitySoftDeleted => repository.SoftDeleteByEvent(id, createSoftDeleteEvent); public async Task ReadEventsFromStreamRaw(string id) { - var client = GetConnection(); - var result = new List(); - var readResults = client.ReadStreamAsync(Direction.Forwards, id, StreamPosition.Start); + var connection = GetConnection(); + var readResults = connection.ReadStreamAsync(Direction.Forwards, id, StreamPosition.Start); return await readResults.ToArrayAsync(); } internal async Task WriteEventsToStreamRaw(string currentStreamInUse, IEnumerable myEvents) { - var conn = await SetupConnection(); + var connection = GetConnection(); - await conn.AppendToStreamAsync(currentStreamInUse, StreamState.Any, + await connection.AppendToStreamAsync(currentStreamInUse, StreamState.Any, myEvents.Select(e => { var serialized = JsonConvert.SerializeObject(e); @@ -130,6 +227,7 @@ private static async Task SetupConnection() var client = new EventStoreClient(settings); var projectionsClient = new EventStoreProjectionManagementClient(settings); await projectionsClient.EnableAsync("$by_category"); + await projectionsClient.EnableAsync("$by_event_type"); await Task.Delay(TimeSpan.FromSeconds(3)); diff --git a/src/BullOak.Repositories.EventStore.Test.Integration/EventStoreServer/EventStore.ClusterNode.exe b/src/BullOak.Repositories.EventStore.Test.Integration/EventStoreServer/EventStore.ClusterNode.exe deleted file mode 100644 index ad704a7..0000000 Binary files a/src/BullOak.Repositories.EventStore.Test.Integration/EventStoreServer/EventStore.ClusterNode.exe and /dev/null differ diff --git a/src/BullOak.Repositories.EventStore.Test.Integration/Specification/EventStoreMetadataSupport.feature b/src/BullOak.Repositories.EventStore.Test.Integration/Specification/EventStoreMetadataSupport.feature new file mode 100644 index 0000000..b2db2d1 --- /dev/null +++ b/src/BullOak.Repositories.EventStore.Test.Integration/Specification/EventStoreMetadataSupport.feature @@ -0,0 +1,67 @@ +Feature: EventStore Metadata Support + In order to be able to use the library with any EventStore stream + As a developer using this library + I want to be able to use session with regular streams and projections containing + metadata entries not related to regular events, e.g. links to missing events + + Scenario: Open EventStore deleted stream + + As opposed to event-based soft deleted stream (by using custom EntitySoftDeleted event), + EventStore soft-deleted stream is a stream that has been deleted via ES Admin Console + or by using HTTP DELETE operation. ES adds a soft-delete metadata marker and scavenges (eventually) + all the existing events from the stream. + + Given a stream with events + And I delete the stream in EventStore + When I try to open the stream + Then the session reports new state + + Scenario: Append events to EventStore deleted stream + + Given a stream with events + And I delete the stream in EventStore + And I add some new events to the stream + When I try to open the stream + Then the session can rehydrate the state + + Scenario: Open EventStore truncated stream + + EventStore allows to truncate all the events in the stream before a given event version N. + ES modifies the stream metadata and scavenges (eventually) all the events before version N. + Resulting stream looks just like a non-truncated stream, except the first event in the stream + has id N and not 0. + + Semantically, an empty stream after being truncated is the same as an empty projection + + Given a stream with events + And I truncate the stream in EventStore + When I try to open the stream + Then the session reports new state + + Scenario: Append events to EventStore truncated stream + + Given a stream with events + And I truncate the stream in EventStore + And I add some new events to the stream + When I try to open the stream + Then the session can rehydrate the state + + Scenario: Open EventStore projection pointing to undefined events + + Session can be used pointing to a projection that does not include any events. + + When I try to open a projection that uses undefined events + Then the session reports new state + + Scenario: Open EventStore projection containing links to deleted events + + https://developers.eventstore.com/server/v20.10/docs/streams/deleting-streams-and-events.html#deleted-events-and-projections + + Projections may contain metadata entries that do no resolve to an actual event + because the original event was truncated. + + Given a stream with events + And I truncate the stream in EventStore + And I add some new events to the stream + When I try to open a projection that uses events from the truncated stream + Then the session can rehydrate the state diff --git a/src/BullOak.Repositories.EventStore.Test.Integration/Specification/ReadModelSpecs.feature.cs b/src/BullOak.Repositories.EventStore.Test.Integration/Specification/ReadModelSpecs.feature.cs deleted file mode 100644 index 71518c8..0000000 --- a/src/BullOak.Repositories.EventStore.Test.Integration/Specification/ReadModelSpecs.feature.cs +++ /dev/null @@ -1,410 +0,0 @@ -// ------------------------------------------------------------------------------ -// -// This code was generated by SpecFlow (https://www.specflow.org/). -// SpecFlow Version:3.9.0.0 -// SpecFlow Generator Version:3.9.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ -#region Designer generated code -#pragma warning disable -namespace BullOak.Repositories.EventStore.Test.Integration.Specification -{ - using TechTalk.SpecFlow; - using System; - using System.Linq; - - - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.9.0.0")] - [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public partial class ReadModelSpecsFeature : object, Xunit.IClassFixture, System.IDisposable - { - - private static TechTalk.SpecFlow.ITestRunner testRunner; - - private string[] _featureTags = ((string[])(null)); - - private Xunit.Abstractions.ITestOutputHelper _testOutputHelper; - -#line 1 "ReadModelSpecs.feature" -#line hidden - - public ReadModelSpecsFeature(ReadModelSpecsFeature.FixtureData fixtureData, BullOak_Repositories_EventStore_Test_Integration_XUnitAssemblyFixture assemblyFixture, Xunit.Abstractions.ITestOutputHelper testOutputHelper) - { - this._testOutputHelper = testOutputHelper; - this.TestInitialize(); - } - - public static void FeatureSetup() - { - testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); - TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Specification", "ReadModelSpecs", "\tIn order to support read models\r\n\tAs a user of this library\r\n\tI want to be able " + - "to load entities from readonly repositories", ProgrammingLanguage.CSharp, ((string[])(null))); - testRunner.OnFeatureStart(featureInfo); - } - - public static void FeatureTearDown() - { - testRunner.OnFeatureEnd(); - testRunner = null; - } - - public virtual void TestInitialize() - { - } - - public virtual void TestTearDown() - { - testRunner.OnScenarioEnd(); - } - - public virtual void ScenarioInitialize(TechTalk.SpecFlow.ScenarioInfo scenarioInfo) - { - testRunner.OnScenarioInitialize(scenarioInfo); - testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(_testOutputHelper); - } - - public virtual void ScenarioStart() - { - testRunner.OnScenarioStart(); - } - - public virtual void ScenarioCleanup() - { - testRunner.CollectScenarioErrors(); - } - - void System.IDisposable.Dispose() - { - this.TestTearDown(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Reconstitute state from one event stored using interface")] - [Xunit.TraitAttribute("FeatureTitle", "ReadModelSpecs")] - [Xunit.TraitAttribute("Description", "Reconstitute state from one event stored using interface")] - public virtual void ReconstituteStateFromOneEventStoredUsingInterface() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Reconstitute state from one event stored using interface", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 6 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 7 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 8 - testRunner.And("3 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 9 - testRunner.And("I try to save the new events in the stream through their interface", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 10 - testRunner.When("I load my entity through the read-only repository", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 11 - testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 12 - testRunner.And("HighOrder property should be 2", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 13 - testRunner.And("have a concurrency id of 2", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Load entity as at a point in time")] - [Xunit.TraitAttribute("FeatureTitle", "ReadModelSpecs")] - [Xunit.TraitAttribute("Description", "Load entity as at a point in time")] - public virtual void LoadEntityAsAtAPointInTime() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Load entity as at a point in time", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 15 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 16 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden - TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] { - "Timestamp"}); - table1.AddRow(new string[] { - "2020-09-10 11:10:00"}); - table1.AddRow(new string[] { - "2020-09-20 11:10:00"}); - table1.AddRow(new string[] { - "2020-09-23 11:10:00"}); -#line 17 - testRunner.And("the following events with the following timestamps", ((string)(null)), table1, "And "); -#line hidden -#line 22 - testRunner.And("I try to save the new events in the stream through their interface", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 23 - testRunner.When("I load my entity through the read-only repository as of \'2020-09-22 11:10:00\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 24 - testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 25 - testRunner.And("HighOrder property should be 1", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Reconstitute streams with one event type based on category")] - [Xunit.TraitAttribute("FeatureTitle", "ReadModelSpecs")] - [Xunit.TraitAttribute("Description", "Reconstitute streams with one event type based on category")] - public virtual void ReconstituteStreamsWithOneEventTypeBasedOnCategory() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Reconstitute streams with one event type based on category", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 27 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 28 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden - TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] { - "Timestamp"}); - table2.AddRow(new string[] { - "2020-09-10 11:10:00"}); - table2.AddRow(new string[] { - "2020-09-20 11:10:00"}); - table2.AddRow(new string[] { - "2020-09-23 11:10:00"}); -#line 29 - testRunner.And("the following events with the following timestamps", ((string)(null)), table2, "And "); -#line hidden -#line 34 - testRunner.And("I try to save the new events in the stream through their interface", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 35 - testRunner.When("I load all my entities for the streams category", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 36 - testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 37 - testRunner.And("HighOrder property should be 2", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Reconstitute streams with one event type based on category up to a given date")] - [Xunit.TraitAttribute("FeatureTitle", "ReadModelSpecs")] - [Xunit.TraitAttribute("Description", "Reconstitute streams with one event type based on category up to a given date")] - public virtual void ReconstituteStreamsWithOneEventTypeBasedOnCategoryUpToAGivenDate() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Reconstitute streams with one event type based on category up to a given date", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 39 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 40 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 41 - testRunner.And("another new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] { - "Timestamp"}); - table3.AddRow(new string[] { - "2020-09-10 11:10:00"}); - table3.AddRow(new string[] { - "2020-09-20 11:10:00"}); - table3.AddRow(new string[] { - "2020-09-23 11:10:00"}); -#line 42 - testRunner.And("the following events with timestamps for stream 1", ((string)(null)), table3, "And "); -#line hidden - TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] { - "Timestamp"}); - table4.AddRow(new string[] { - "2020-09-10 11:10:00"}); - table4.AddRow(new string[] { - "2020-09-20 11:10:00"}); - table4.AddRow(new string[] { - "2020-09-20 12:10:00"}); - table4.AddRow(new string[] { - "2020-09-20 12:20:00"}); - table4.AddRow(new string[] { - "2020-09-23 11:10:00"}); -#line 47 - testRunner.And("the following events with timestamps for stream 2", ((string)(null)), table4, "And "); -#line hidden -#line 54 - testRunner.And("I try to save the new events in the stream through their interface", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 55 - testRunner.When("I load all my entities as of \'2020-09-22 11:10:00\' for the streams category", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 56 - testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 57 - testRunner.And("HighOrder property for stream 1 should be 1", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 58 - testRunner.And("HighOrder property for stream 2 should be 3", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Reconstitute state based on category with two event types up to a given date")] - [Xunit.TraitAttribute("FeatureTitle", "ReadModelSpecs")] - [Xunit.TraitAttribute("Description", "Reconstitute state based on category with two event types up to a given date")] - public virtual void ReconstituteStateBasedOnCategoryWithTwoEventTypesUpToAGivenDate() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Reconstitute state based on category with two event types up to a given date", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 60 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 61 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden - TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] { - "Timestamp"}); - table5.AddRow(new string[] { - "2020-09-10 11:10:00"}); -#line 62 - testRunner.And("the following events with the following timestamps", ((string)(null)), table5, "And "); -#line hidden -#line 65 - testRunner.And("I try to save the new events in the stream through their interface", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 66 - testRunner.And("I update the state of visible to be enabled as of \'2020-09-22 11:10:00\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 67 - testRunner.When("I load all my entities as of \'2020-09-20 11:10:00\' for the streams category", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 68 - testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 69 - testRunner.And("after waiting for 15 seconds for categories to be processed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 70 - testRunner.And("the visibilty should be disabled", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.9.0.0")] - [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class FixtureData : System.IDisposable - { - - public FixtureData() - { - ReadModelSpecsFeature.FeatureSetup(); - } - - void System.IDisposable.Dispose() - { - ReadModelSpecsFeature.FeatureTearDown(); - } - } - } -} -#pragma warning restore -#endregion diff --git a/src/BullOak.Repositories.EventStore.Test.Integration/Specification/ReconstituteState.feature.cs b/src/BullOak.Repositories.EventStore.Test.Integration/Specification/ReconstituteState.feature.cs deleted file mode 100644 index a247d9c..0000000 --- a/src/BullOak.Repositories.EventStore.Test.Integration/Specification/ReconstituteState.feature.cs +++ /dev/null @@ -1,513 +0,0 @@ -// ------------------------------------------------------------------------------ -// -// This code was generated by SpecFlow (https://www.specflow.org/). -// SpecFlow Version:3.9.0.0 -// SpecFlow Generator Version:3.9.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ -#region Designer generated code -#pragma warning disable -namespace BullOak.Repositories.EventStore.Test.Integration.Specification -{ - using TechTalk.SpecFlow; - using System; - using System.Linq; - - - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.9.0.0")] - [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public partial class ReconstituteStateFeature : object, Xunit.IClassFixture, System.IDisposable - { - - private static TechTalk.SpecFlow.ITestRunner testRunner; - - private string[] _featureTags = ((string[])(null)); - - private Xunit.Abstractions.ITestOutputHelper _testOutputHelper; - -#line 1 "ReconstituteState.feature" -#line hidden - - public ReconstituteStateFeature(ReconstituteStateFeature.FixtureData fixtureData, BullOak_Repositories_EventStore_Test_Integration_XUnitAssemblyFixture assemblyFixture, Xunit.Abstractions.ITestOutputHelper testOutputHelper) - { - this._testOutputHelper = testOutputHelper; - this.TestInitialize(); - } - - public static void FeatureSetup() - { - testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); - TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Specification", "ReconstituteState", "\tIn order to apply business logic on stored entities\r\n\tAs a developer using this " + - "library\r\n\tI want to be able to get correctly reconstituted states from my event " + - "stream", ProgrammingLanguage.CSharp, ((string[])(null))); - testRunner.OnFeatureStart(featureInfo); - } - - public static void FeatureTearDown() - { - testRunner.OnFeatureEnd(); - testRunner = null; - } - - public virtual void TestInitialize() - { - } - - public virtual void TestTearDown() - { - testRunner.OnScenarioEnd(); - } - - public virtual void ScenarioInitialize(TechTalk.SpecFlow.ScenarioInfo scenarioInfo) - { - testRunner.OnScenarioInitialize(scenarioInfo); - testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(_testOutputHelper); - } - - public virtual void ScenarioStart() - { - testRunner.OnScenarioStart(); - } - - public virtual void ScenarioCleanup() - { - testRunner.CollectScenarioErrors(); - } - - void System.IDisposable.Dispose() - { - this.TestTearDown(); - } - - [Xunit.SkippableTheoryAttribute(DisplayName="Load stored entity with from existing events")] - [Xunit.TraitAttribute("FeatureTitle", "ReconstituteState")] - [Xunit.TraitAttribute("Description", "Load stored entity with from existing events")] - [Xunit.InlineDataAttribute("2", "1", new string[0])] - [Xunit.InlineDataAttribute("5", "4", new string[0])] - [Xunit.InlineDataAttribute("10000", "9999", new string[0])] - public virtual void LoadStoredEntityWithFromExistingEvents(string eventsCount, string expectedState, string[] exampleTags) - { - string[] tagsOfScenario = exampleTags; - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - argumentsOfScenario.Add("eventsCount", eventsCount); - argumentsOfScenario.Add("expectedState", expectedState); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Load stored entity with from existing events", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 6 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 7 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 8 - testRunner.And(string.Format("{0} new events", eventsCount), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 9 - testRunner.When("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 10 - testRunner.And("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 11 - testRunner.Then(string.Format("HighOrder property should be {0}", expectedState), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Reconstitute state from one event stored using interface")] - [Xunit.TraitAttribute("FeatureTitle", "ReconstituteState")] - [Xunit.TraitAttribute("Description", "Reconstitute state from one event stored using interface")] - public virtual void ReconstituteStateFromOneEventStoredUsingInterface() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Reconstitute state from one event stored using interface", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 19 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 20 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 21 - testRunner.And("3 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 22 - testRunner.And("I try to save the new events in the stream through their interface", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 23 - testRunner.When("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 24 - testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 25 - testRunner.And("HighOrder property should be 2", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Reconstitute state up to a given date")] - [Xunit.TraitAttribute("FeatureTitle", "ReconstituteState")] - [Xunit.TraitAttribute("Description", "Reconstitute state up to a given date")] - public virtual void ReconstituteStateUpToAGivenDate() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Reconstitute state up to a given date", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 27 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 28 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden - TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] { - "Timestamp"}); - table6.AddRow(new string[] { - "2020-09-10 11:10:00"}); - table6.AddRow(new string[] { - "2020-09-20 11:10:00"}); - table6.AddRow(new string[] { - "2020-09-23 11:10:00"}); -#line 29 - testRunner.And("the following events with the following timestamps", ((string)(null)), table6, "And "); -#line hidden -#line 34 - testRunner.And("I try to save the new events in the stream through their interface", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 35 - testRunner.When("I load my entity as of \'2020-09-22 11:10:00\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 36 - testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 37 - testRunner.And("HighOrder property should be 1", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Reconstitute state from empty stream should succeed and return default state")] - [Xunit.TraitAttribute("FeatureTitle", "ReconstituteState")] - [Xunit.TraitAttribute("Description", "Reconstitute state from empty stream should succeed and return default state")] - public virtual void ReconstituteStateFromEmptyStreamShouldSucceedAndReturnDefaultState() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Reconstitute state from empty stream should succeed and return default state", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 39 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 40 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 41 - testRunner.When("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 42 - testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 43 - testRunner.And("HighOrder property should be 0", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Reconstitute state after a soft delete should succeed and return default state")] - [Xunit.TraitAttribute("FeatureTitle", "ReconstituteState")] - [Xunit.TraitAttribute("Description", "Reconstitute state after a soft delete should succeed and return default state")] - public virtual void ReconstituteStateAfterASoftDeleteShouldSucceedAndReturnDefaultState() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Reconstitute state after a soft delete should succeed and return default state", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 45 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 46 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 47 - testRunner.And("3 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 48 - testRunner.And("I soft-delete the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 49 - testRunner.When("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 50 - testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 51 - testRunner.And("HighOrder property should be 0", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Reconstitute state after a hard delete should succeed and return default state")] - [Xunit.TraitAttribute("FeatureTitle", "ReconstituteState")] - [Xunit.TraitAttribute("Description", "Reconstitute state after a hard delete should succeed and return default state")] - public virtual void ReconstituteStateAfterAHardDeleteShouldSucceedAndReturnDefaultState() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Reconstitute state after a hard delete should succeed and return default state", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 53 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 54 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 55 - testRunner.And("3 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 56 - testRunner.And("I hard-delete the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 57 - testRunner.When("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 58 - testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 59 - testRunner.And("HighOrder property should be 0", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Reconstitute state after a soft delete by event should succeed and return default" + - " state")] - [Xunit.TraitAttribute("FeatureTitle", "ReconstituteState")] - [Xunit.TraitAttribute("Description", "Reconstitute state after a soft delete by event should succeed and return default" + - " state")] - public virtual void ReconstituteStateAfterASoftDeleteByEventShouldSucceedAndReturnDefaultState() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Reconstitute state after a soft delete by event should succeed and return default" + - " state", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 61 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 62 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 63 - testRunner.And("3 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 64 - testRunner.And("I soft-delete-by-event the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 65 - testRunner.When("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 66 - testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 67 - testRunner.And("HighOrder property should be 0", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Reconstitute state after a soft delete by custom event should succeed and return " + - "default state")] - [Xunit.TraitAttribute("FeatureTitle", "ReconstituteState")] - [Xunit.TraitAttribute("Description", "Reconstitute state after a soft delete by custom event should succeed and return " + - "default state")] - public virtual void ReconstituteStateAfterASoftDeleteByCustomEventShouldSucceedAndReturnDefaultState() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Reconstitute state after a soft delete by custom event should succeed and return " + - "default state", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 69 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 70 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 71 - testRunner.And("3 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 72 - testRunner.And("I soft-delete-by-custom-event the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 73 - testRunner.When("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 74 - testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 75 - testRunner.And("HighOrder property should be 0", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.9.0.0")] - [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class FixtureData : System.IDisposable - { - - public FixtureData() - { - ReconstituteStateFeature.FeatureSetup(); - } - - void System.IDisposable.Dispose() - { - ReconstituteStateFeature.FeatureTearDown(); - } - } - } -} -#pragma warning restore -#endregion diff --git a/src/BullOak.Repositories.EventStore.Test.Integration/Specification/SaveEventStream.feature.cs b/src/BullOak.Repositories.EventStore.Test.Integration/Specification/SaveEventStream.feature.cs deleted file mode 100644 index 6b2df1b..0000000 --- a/src/BullOak.Repositories.EventStore.Test.Integration/Specification/SaveEventStream.feature.cs +++ /dev/null @@ -1,843 +0,0 @@ -// ------------------------------------------------------------------------------ -// -// This code was generated by SpecFlow (https://www.specflow.org/). -// SpecFlow Version:3.9.0.0 -// SpecFlow Generator Version:3.9.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ -#region Designer generated code -#pragma warning disable -namespace BullOak.Repositories.EventStore.Test.Integration.Specification -{ - using TechTalk.SpecFlow; - using System; - using System.Linq; - - - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.9.0.0")] - [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public partial class SaveEventsStreamFeature : object, Xunit.IClassFixture, System.IDisposable - { - - private static TechTalk.SpecFlow.ITestRunner testRunner; - - private string[] _featureTags = ((string[])(null)); - - private Xunit.Abstractions.ITestOutputHelper _testOutputHelper; - -#line 1 "SaveEventStream.feature" -#line hidden - - public SaveEventsStreamFeature(SaveEventsStreamFeature.FixtureData fixtureData, BullOak_Repositories_EventStore_Test_Integration_XUnitAssemblyFixture assemblyFixture, Xunit.Abstractions.ITestOutputHelper testOutputHelper) - { - this._testOutputHelper = testOutputHelper; - this.TestInitialize(); - } - - public static void FeatureSetup() - { - testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); - TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Specification", "SaveEventsStream", "\tIn order to persist using an event stream\r\n\tAs a developer usint this new librar" + - "y\r\n\tI want to be able to save events in a stream", ProgrammingLanguage.CSharp, ((string[])(null))); - testRunner.OnFeatureStart(featureInfo); - } - - public static void FeatureTearDown() - { - testRunner.OnFeatureEnd(); - testRunner = null; - } - - public virtual void TestInitialize() - { - } - - public virtual void TestTearDown() - { - testRunner.OnScenarioEnd(); - } - - public virtual void ScenarioInitialize(TechTalk.SpecFlow.ScenarioInfo scenarioInfo) - { - testRunner.OnScenarioInitialize(scenarioInfo); - testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(_testOutputHelper); - } - - public virtual void ScenarioStart() - { - testRunner.OnScenarioStart(); - } - - public virtual void ScenarioCleanup() - { - testRunner.CollectScenarioErrors(); - } - - void System.IDisposable.Dispose() - { - this.TestTearDown(); - } - - [Xunit.SkippableTheoryAttribute(DisplayName="Save events in a new stream")] - [Xunit.TraitAttribute("FeatureTitle", "SaveEventsStream")] - [Xunit.TraitAttribute("Description", "Save events in a new stream")] - [Xunit.InlineDataAttribute("1", new string[0])] - [Xunit.InlineDataAttribute("30", new string[0])] - [Xunit.InlineDataAttribute("10000", new string[0])] - public virtual void SaveEventsInANewStream(string eventsCount, string[] exampleTags) - { - string[] tagsOfScenario = exampleTags; - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - argumentsOfScenario.Add("eventsCount", eventsCount); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Save events in a new stream", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 6 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 7 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 8 - testRunner.And(string.Format("{0} new events", eventsCount), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 9 - testRunner.When("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 10 - testRunner.Then("the save process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 11 - testRunner.And(string.Format("there should be {0} events in the stream", eventsCount), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Save one event using interface")] - [Xunit.TraitAttribute("FeatureTitle", "SaveEventsStream")] - [Xunit.TraitAttribute("Description", "Save one event using interface")] - public virtual void SaveOneEventUsingInterface() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Save one event using interface", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 18 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 19 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 20 - testRunner.And("1 new event", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 21 - testRunner.When("I try to save the new events in the stream through their interface", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 22 - testRunner.Then("the save process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Save additional events in an existing stream")] - [Xunit.TraitAttribute("FeatureTitle", "SaveEventsStream")] - [Xunit.TraitAttribute("Description", "Save additional events in an existing stream")] - public virtual void SaveAdditionalEventsInAnExistingStream() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Save additional events in an existing stream", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 24 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 25 - testRunner.Given("an existing stream with 10 events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 26 - testRunner.And("10 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 27 - testRunner.When("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 28 - testRunner.Then("the save process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 29 - testRunner.And("there should be 20 events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Concurrent write should fail for outdated session")] - [Xunit.TraitAttribute("FeatureTitle", "SaveEventsStream")] - [Xunit.TraitAttribute("Description", "Concurrent write should fail for outdated session")] - public virtual void ConcurrentWriteShouldFailForOutdatedSession() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Concurrent write should fail for outdated session", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 31 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 32 - testRunner.Given("an existing stream with 10 events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 33 - testRunner.And("session \'Session1\' is open", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 34 - testRunner.And("session \'Session2\' is open", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 35 - testRunner.And("10 new events are added by \'Session1\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 36 - testRunner.And("10 new events are added by \'Session2\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 37 - testRunner.When("I try to save \'Session1\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 38 - testRunner.And("I try to save \'Session2\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 39 - testRunner.Then("the save process should succeed for \'Session1\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 40 - testRunner.And("the save process should fail for \'Session2\' with ConcurrencyException", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 41 - testRunner.And("there should be 20 events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Saving already saved session should throw meaningful usage advice exception")] - [Xunit.TraitAttribute("FeatureTitle", "SaveEventsStream")] - [Xunit.TraitAttribute("Description", "Saving already saved session should throw meaningful usage advice exception")] - public virtual void SavingAlreadySavedSessionShouldThrowMeaningfulUsageAdviceException() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Saving already saved session should throw meaningful usage advice exception", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 43 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 44 - testRunner.Given("an existing stream with 10 events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 45 - testRunner.And("session \'Session1\' is open", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 46 - testRunner.And("10 new events are added by \'Session1\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 47 - testRunner.When("I try to save \'Session1\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 48 - testRunner.And("I try to save \'Session1\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 49 - testRunner.Then("the save process should fail for \'Session1\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 50 - testRunner.And("there should be 20 events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Write after a hard deleted stream should fail")] - [Xunit.TraitAttribute("FeatureTitle", "SaveEventsStream")] - [Xunit.TraitAttribute("Description", "Write after a hard deleted stream should fail")] - public virtual void WriteAfterAHardDeletedStreamShouldFail() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Write after a hard deleted stream should fail", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 52 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 53 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 54 - testRunner.And("3 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 55 - testRunner.And("I hard-delete the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 56 - testRunner.And("10 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 57 - testRunner.When("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 58 - testRunner.Then("the save process should fail", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="Write after a soft deleted stream should succeed")] - [Xunit.TraitAttribute("FeatureTitle", "SaveEventsStream")] - [Xunit.TraitAttribute("Description", "Write after a soft deleted stream should succeed")] - public virtual void WriteAfterASoftDeletedStreamShouldSucceed() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Write after a soft deleted stream should succeed", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 60 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 61 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 62 - testRunner.And("3 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 63 - testRunner.And("I soft-delete the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 64 - testRunner.And("10 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 65 - testRunner.When("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 66 - testRunner.And("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 67 - testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 68 - testRunner.And("HighOrder property should be 9", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableTheoryAttribute(DisplayName="Write after a soft delete by event for a stream should succeed")] - [Xunit.TraitAttribute("FeatureTitle", "SaveEventsStream")] - [Xunit.TraitAttribute("Description", "Write after a soft delete by event for a stream should succeed")] - [Xunit.InlineDataAttribute("3", "10", "9", new string[0])] - [Xunit.InlineDataAttribute("10", "3", "2", new string[0])] - [Xunit.InlineDataAttribute("10", "10000", "9999", new string[0])] - [Xunit.InlineDataAttribute("10000", "10", "9", new string[0])] - public virtual void WriteAfterASoftDeleteByEventForAStreamShouldSucceed(string eventsCount1, string eventsCount2, string highOrder, string[] exampleTags) - { - string[] tagsOfScenario = exampleTags; - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - argumentsOfScenario.Add("eventsCount1", eventsCount1); - argumentsOfScenario.Add("eventsCount2", eventsCount2); - argumentsOfScenario.Add("highOrder", highOrder); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Write after a soft delete by event for a stream should succeed", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 70 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 71 - testRunner.Given(string.Format("an existing stream with {0} events", eventsCount1), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 72 - testRunner.And("I soft-delete-by-event the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 73 - testRunner.And(string.Format("{0} new events", eventsCount2), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 74 - testRunner.When("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 75 - testRunner.And("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 76 - testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 77 - testRunner.And(string.Format("HighOrder property should be {0}", highOrder), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableTheoryAttribute(DisplayName="Write after a soft delete by event and new session opened should succeed")] - [Xunit.TraitAttribute("FeatureTitle", "SaveEventsStream")] - [Xunit.TraitAttribute("Description", "Write after a soft delete by event and new session opened should succeed")] - [Xunit.InlineDataAttribute("3", "10", "9", new string[0])] - [Xunit.InlineDataAttribute("10", "3", "2", new string[0])] - [Xunit.InlineDataAttribute("10", "10000", "9999", new string[0])] - [Xunit.InlineDataAttribute("10000", "10", "9", new string[0])] - public virtual void WriteAfterASoftDeleteByEventAndNewSessionOpenedShouldSucceed(string eventsCount1, string eventsCount2, string highOrder, string[] exampleTags) - { - string[] tagsOfScenario = exampleTags; - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - argumentsOfScenario.Add("eventsCount1", eventsCount1); - argumentsOfScenario.Add("eventsCount2", eventsCount2); - argumentsOfScenario.Add("highOrder", highOrder); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Write after a soft delete by event and new session opened should succeed", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 85 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 86 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 87 - testRunner.And("session \'session1\' is open", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 88 - testRunner.And(string.Format("{0} new events are added by \'session1\'", eventsCount1), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 89 - testRunner.When("I try to save \'session1\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 90 - testRunner.And("I soft-delete-by-event the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 91 - testRunner.And("I open session \'session2\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 92 - testRunner.And(string.Format("I try to add {0} new events to \'session2\'", eventsCount2), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 93 - testRunner.And("I try to save \'session2\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 94 - testRunner.And("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 95 - testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 96 - testRunner.And(string.Format("HighOrder property should be {0}", highOrder), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableTheoryAttribute(DisplayName="Write after a soft delete by custom event for a stream should succeed")] - [Xunit.TraitAttribute("FeatureTitle", "SaveEventsStream")] - [Xunit.TraitAttribute("Description", "Write after a soft delete by custom event for a stream should succeed")] - [Xunit.InlineDataAttribute("3", "10", "9", new string[0])] - [Xunit.InlineDataAttribute("10", "3", "2", new string[0])] - [Xunit.InlineDataAttribute("10", "10000", "9999", new string[0])] - [Xunit.InlineDataAttribute("10000", "10", "9", new string[0])] - public virtual void WriteAfterASoftDeleteByCustomEventForAStreamShouldSucceed(string eventsCount1, string eventsCount2, string highOrder, string[] exampleTags) - { - string[] tagsOfScenario = exampleTags; - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - argumentsOfScenario.Add("eventsCount1", eventsCount1); - argumentsOfScenario.Add("eventsCount2", eventsCount2); - argumentsOfScenario.Add("highOrder", highOrder); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Write after a soft delete by custom event for a stream should succeed", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 104 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 105 - testRunner.Given(string.Format("an existing stream with {0} events", eventsCount1), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 106 - testRunner.And("I soft-delete-by-custom-event the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 107 - testRunner.And(string.Format("{0} new events", eventsCount2), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 108 - testRunner.When("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 109 - testRunner.And("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 110 - testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 111 - testRunner.And(string.Format("HighOrder property should be {0}", highOrder), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableTheoryAttribute(DisplayName="Write after a soft delete by custom event and new session opened should succeed")] - [Xunit.TraitAttribute("FeatureTitle", "SaveEventsStream")] - [Xunit.TraitAttribute("Description", "Write after a soft delete by custom event and new session opened should succeed")] - [Xunit.InlineDataAttribute("3", "10", "9", new string[0])] - [Xunit.InlineDataAttribute("10", "3", "2", new string[0])] - [Xunit.InlineDataAttribute("10", "10000", "9999", new string[0])] - [Xunit.InlineDataAttribute("10000", "10", "9", new string[0])] - public virtual void WriteAfterASoftDeleteByCustomEventAndNewSessionOpenedShouldSucceed(string eventsCount1, string eventsCount2, string highOrder, string[] exampleTags) - { - string[] tagsOfScenario = exampleTags; - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - argumentsOfScenario.Add("eventsCount1", eventsCount1); - argumentsOfScenario.Add("eventsCount2", eventsCount2); - argumentsOfScenario.Add("highOrder", highOrder); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Write after a soft delete by custom event and new session opened should succeed", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 119 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 120 - testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 121 - testRunner.And("session \'session1\' is open", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 122 - testRunner.And(string.Format("{0} new events are added by \'session1\'", eventsCount1), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 123 - testRunner.When("I try to save \'session1\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 124 - testRunner.And("I soft-delete-by-custom-event the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 125 - testRunner.And("I open session \'session2\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 126 - testRunner.And(string.Format("I try to add {0} new events to \'session2\'", eventsCount2), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 127 - testRunner.And("I try to save \'session2\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 128 - testRunner.And("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 129 - testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 130 - testRunner.And(string.Format("HighOrder property should be {0}", highOrder), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableFactAttribute(DisplayName="When invariants fail no events are saved")] - [Xunit.TraitAttribute("FeatureTitle", "SaveEventsStream")] - [Xunit.TraitAttribute("Description", "When invariants fail no events are saved")] - public virtual void WhenInvariantsFailNoEventsAreSaved() - { - string[] tagsOfScenario = ((string[])(null)); - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("When invariants fail no events are saved", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 138 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 139 - testRunner.Given("an always-fail invariant checker", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 140 - testRunner.And("an existing stream with 3 events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 141 - testRunner.And("5 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 142 - testRunner.When("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 143 - testRunner.And("I load my entity ignoring any errors", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 144 - testRunner.Then("the save process should fail", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 145 - testRunner.And("HighOrder property should be 2", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [Xunit.SkippableTheoryAttribute(DisplayName="When invariants pass events are saved normally")] - [Xunit.TraitAttribute("FeatureTitle", "SaveEventsStream")] - [Xunit.TraitAttribute("Description", "When invariants pass events are saved normally")] - [Xunit.InlineDataAttribute("3", "10", "5", "fail", "2", new string[0])] - [Xunit.InlineDataAttribute("10", "20", "20", "succeed", "19", new string[0])] - [Xunit.InlineDataAttribute("1", "5", "20", "succeed", "4", new string[0])] - public virtual void WhenInvariantsPassEventsAreSavedNormally(string existingCount, string newEventsCount, string maxHighOrder, string outcome, string expectedHighOrder, string[] exampleTags) - { - string[] tagsOfScenario = exampleTags; - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - argumentsOfScenario.Add("existingCount", existingCount); - argumentsOfScenario.Add("newEventsCount", newEventsCount); - argumentsOfScenario.Add("maxHighOrder", maxHighOrder); - argumentsOfScenario.Add("outcome", outcome); - argumentsOfScenario.Add("expectedHighOrder", expectedHighOrder); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("When invariants pass events are saved normally", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 147 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 148 - testRunner.Given(string.Format("an invariant checker that allows a maximum higher order of {0}", maxHighOrder), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 149 - testRunner.And(string.Format("an existing stream with {0} events", existingCount), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 150 - testRunner.And(string.Format("{0} new events", newEventsCount), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 151 - testRunner.When("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 152 - testRunner.And("I load my entity ignoring any errors", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden -#line 153 - testRunner.Then(string.Format("the save process should {0}", outcome), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden -#line 154 - testRunner.And(string.Format("HighOrder property should be {0}", expectedHighOrder), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line hidden - } - this.ScenarioCleanup(); - } - - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.9.0.0")] - [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class FixtureData : System.IDisposable - { - - public FixtureData() - { - SaveEventsStreamFeature.FeatureSetup(); - } - - void System.IDisposable.Dispose() - { - SaveEventsStreamFeature.FeatureTearDown(); - } - } - } -} -#pragma warning restore -#endregion diff --git a/src/BullOak.Repositories.EventStore.Test.Integration/Specification/StateRetreivalSpecs.feature.cs b/src/BullOak.Repositories.EventStore.Test.Integration/Specification/StateRetreivalSpecs.feature.cs deleted file mode 100644 index 1f87501..0000000 --- a/src/BullOak.Repositories.EventStore.Test.Integration/Specification/StateRetreivalSpecs.feature.cs +++ /dev/null @@ -1,151 +0,0 @@ -// ------------------------------------------------------------------------------ -// -// This code was generated by SpecFlow (https://www.specflow.org/). -// SpecFlow Version:3.9.0.0 -// SpecFlow Generator Version:3.9.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ -#region Designer generated code -#pragma warning disable -namespace BullOak.Repositories.EventStore.Test.Integration.Specification -{ - using TechTalk.SpecFlow; - using System; - using System.Linq; - - - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.9.0.0")] - [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public partial class StateRetrievalSpecsFeature : object, Xunit.IClassFixture, System.IDisposable - { - - private static TechTalk.SpecFlow.ITestRunner testRunner; - - private string[] _featureTags = ((string[])(null)); - - private Xunit.Abstractions.ITestOutputHelper _testOutputHelper; - -#line 1 "StateRetreivalSpecs.feature" -#line hidden - - public StateRetrievalSpecsFeature(StateRetrievalSpecsFeature.FixtureData fixtureData, BullOak_Repositories_EventStore_Test_Integration_XUnitAssemblyFixture assemblyFixture, Xunit.Abstractions.ITestOutputHelper testOutputHelper) - { - this._testOutputHelper = testOutputHelper; - this.TestInitialize(); - } - - public static void FeatureSetup() - { - testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); - TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Specification", "StateRetrievalSpecs", "\tIn order to implement complex logic without further state storage\r\n\tAs a develop" + - "er using this library\r\n\tI want the current state to be updated immediately when " + - "I add new events even if I don\'t save the session", ProgrammingLanguage.CSharp, ((string[])(null))); - testRunner.OnFeatureStart(featureInfo); - } - - public static void FeatureTearDown() - { - testRunner.OnFeatureEnd(); - testRunner = null; - } - - public virtual void TestInitialize() - { - } - - public virtual void TestTearDown() - { - testRunner.OnScenarioEnd(); - } - - public virtual void ScenarioInitialize(TechTalk.SpecFlow.ScenarioInfo scenarioInfo) - { - testRunner.OnScenarioInitialize(scenarioInfo); - testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(_testOutputHelper); - } - - public virtual void ScenarioStart() - { - testRunner.OnScenarioStart(); - } - - public virtual void ScenarioCleanup() - { - testRunner.CollectScenarioErrors(); - } - - void System.IDisposable.Dispose() - { - this.TestTearDown(); - } - - [Xunit.SkippableTheoryAttribute(DisplayName="When I add new events in the stream I want the state to be updated immediately")] - [Xunit.TraitAttribute("FeatureTitle", "StateRetrievalSpecs")] - [Xunit.TraitAttribute("Description", "When I add new events in the stream I want the state to be updated immediately")] - [Xunit.InlineDataAttribute("0", "3", "2", new string[0])] - [Xunit.InlineDataAttribute("2", "3", "2", new string[0])] - [Xunit.InlineDataAttribute("7", "3", "6", new string[0])] - [Xunit.InlineDataAttribute("0", "10000", "9999", new string[0])] - public virtual void WhenIAddNewEventsInTheStreamIWantTheStateToBeUpdatedImmediately(string eventCount, string addedEvents, string highOrder, string[] exampleTags) - { - string[] tagsOfScenario = exampleTags; - System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - argumentsOfScenario.Add("eventCount", eventCount); - argumentsOfScenario.Add("addedEvents", addedEvents); - argumentsOfScenario.Add("highOrder", highOrder); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("When I add new events in the stream I want the state to be updated immediately", null, tagsOfScenario, argumentsOfScenario, this._featureTags); -#line 11 -this.ScenarioInitialize(scenarioInfo); -#line hidden - bool isScenarioIgnored = default(bool); - bool isFeatureIgnored = default(bool); - if ((tagsOfScenario != null)) - { - isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((this._featureTags != null)) - { - isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); - } - if ((isScenarioIgnored || isFeatureIgnored)) - { - testRunner.SkipScenario(); - } - else - { - this.ScenarioStart(); -#line 12 - testRunner.Given(string.Format("an existing stream with {0} events", eventCount), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden -#line 13 - testRunner.When(string.Format("I add {0} events in the session without saving it", addedEvents), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line hidden -#line 14 - testRunner.Then(string.Format("HighOrder property should be {0}", highOrder), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden - } - this.ScenarioCleanup(); - } - - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.9.0.0")] - [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class FixtureData : System.IDisposable - { - - public FixtureData() - { - StateRetrievalSpecsFeature.FeatureSetup(); - } - - void System.IDisposable.Dispose() - { - StateRetrievalSpecsFeature.FeatureTearDown(); - } - } - } -} -#pragma warning restore -#endregion diff --git a/src/BullOak.Repositories.EventStore.Test.Integration/StepDefinitions/EventStoreMetadataStepsDefinitions.cs b/src/BullOak.Repositories.EventStore.Test.Integration/StepDefinitions/EventStoreMetadataStepsDefinitions.cs new file mode 100644 index 0000000..e74b5fc --- /dev/null +++ b/src/BullOak.Repositories.EventStore.Test.Integration/StepDefinitions/EventStoreMetadataStepsDefinitions.cs @@ -0,0 +1,114 @@ +namespace BullOak.Repositories.EventStore.Test.Integration.StepDefinitions +{ + using System; + using System.Linq; + using System.Threading.Tasks; + using FluentAssertions; + using TechTalk.SpecFlow; + using Components; + using Contexts; + using Session; + + [Binding] + [Scope(Feature = "EventStore Metadata Support")] + internal class EventStoreMetadataStepsDefinitions + { + private readonly EventStoreIntegrationContext eventStoreContainer; + private readonly EventGenerator eventGenerator; + private string streamId; + private string streamEventName; + private bool isNewState; + private IHoldHigherOrder state; + + public EventStoreMetadataStepsDefinitions( + EventStoreIntegrationContext eventStoreContainer, + EventGenerator eventGenerator) + { + this.eventStoreContainer = eventStoreContainer ?? throw new ArgumentNullException(nameof(eventStoreContainer)); + this.eventGenerator = eventGenerator ?? throw new ArgumentNullException(nameof(eventGenerator)); + + ResetStreamId(); + isNewState = false; + state = default; + } + + [Given(@"a stream with events")] + public Task GivenAStreamWithEvents() + { + ResetStreamId(); + return GivenIAddSomeEventsToTheStream(); + } + + [Given(@"I delete the stream in EventStore")] + public Task GivenIDeleteStreamInEventStore() + { + return eventStoreContainer.SoftDeleteStream(streamId); + } + + [Given(@"I truncate the stream in EventStore")] + public async Task GivenITruncateStreamInEventStore() + { + await eventStoreContainer.TruncateStream(streamId); + await eventStoreContainer.AssertStreamHasNoResolvedEvents(streamId); + } + + [Given(@"I add some new events to the stream")] + public Task GivenIAddSomeEventsToTheStream() + { + var newEvents = eventGenerator.GenerateEvents(5); + streamEventName = newEvents.First().GetType().AssemblyQualifiedName; + return eventStoreContainer.WriteEventsToStreamRaw( + streamId, + newEvents); + } + + [When(@"I try to open the stream")] + public async Task WhenITryToOpenTheStream() + { + using var session = await eventStoreContainer.StartSession(streamId); + RecordCurrentState(session); + } + + [When(@"I try to open a projection that uses undefined events")] + public async Task WhenITryToOpenProjectionForUndefinedEvents() + { + var undefinedEventName = Guid.NewGuid().ToString("N"); + using var session = await eventStoreContainer.StartSession($"$et-{undefinedEventName}"); + RecordCurrentState(session); + } + + [When(@"I try to open a projection that uses events from the truncated stream")] + public async Task WhenITryToOpenProjectionForTruncatedEvents() + { + var projectionName = $"$et-{streamEventName}"; + await eventStoreContainer.AssertStreamHasSomeUnresolvedEvents(projectionName); + + using var session = await eventStoreContainer.StartSession(projectionName); + RecordCurrentState(session); + } + + [Then(@"the session reports new state")] + public void ThenTheSessionReportsNewState() + { + isNewState.Should().BeTrue(); + } + + [Then(@"the session can rehydrate the state")] + public void ThenTheSessionCanRehydrateState() + { + state.Should().NotBeNull(); + } + + private void ResetStreamId() + { + var id = Guid.NewGuid().ToString("N"); + streamId = $"metadata_test_{id}"; + } + + private void RecordCurrentState(IManageSessionOf session) + { + isNewState = session.IsNewState; + state = isNewState ? default : session.GetCurrentState(); + } + } +} diff --git a/src/BullOak.Repositories.EventStore.Test.Integration/StepDefinitions/StreamStepsDefinitions.cs b/src/BullOak.Repositories.EventStore.Test.Integration/StepDefinitions/StreamStepsDefinitions.cs index c5af224..338fe9f 100644 --- a/src/BullOak.Repositories.EventStore.Test.Integration/StepDefinitions/StreamStepsDefinitions.cs +++ b/src/BullOak.Repositories.EventStore.Test.Integration/StepDefinitions/StreamStepsDefinitions.cs @@ -142,7 +142,7 @@ public async Task WhenITryToSaveTheNewEventsInTheStream() [Given(@"I soft-delete the stream")] public Task GivenISoft_DeleteTheStream() - => eventStoreContainer.SoftDeleteStream(testDataContexts.First().CurrentStreamId); + => eventStoreContainer.SoftDeleteStreamFromRepository(testDataContexts.First().CurrentStreamId); [Given(@"I hard-delete the stream")] public Task GivenIHard_DeleteTheStream() @@ -151,12 +151,12 @@ public Task GivenIHard_DeleteTheStream() [Given(@"I soft-delete-by-event the stream")] [When(@"I soft-delete-by-event the stream")] public Task GivenI_Soft_Delete_by_EventTheStream() - => eventStoreContainer.SoftDeleteByEvent(testDataContexts.First().CurrentStreamId); + => eventStoreContainer.SoftDeleteFromRepositoryBySoftDeleteEvent(testDataContexts.First().CurrentStreamId); [Given(@"I soft-delete-by-custom-event the stream")] [When(@"I soft-delete-by-custom-event the stream")] public Task GivenI_Soft_Delete_by_Custom_EventTheStream() - => eventStoreContainer.SoftDeleteByEvent(testDataContexts.First().CurrentStreamId, () => new MyEntitySoftDeleted()); + => eventStoreContainer.SoftDeleteFromRepositoryBySoftDeleteEvent(testDataContexts.First().CurrentStreamId, () => new MyEntitySoftDeleted()); [Then(@"the load process should succeed")] [Then(@"the save process should succeed")] diff --git a/src/BullOak.Repositories.EventStore.Test.Integration/appsettings.json b/src/BullOak.Repositories.EventStore.Test.Integration/appsettings.json deleted file mode 100644 index 25be27a..0000000 --- a/src/BullOak.Repositories.EventStore.Test.Integration/appsettings.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - // EventStore server isolation. - // -- None: expects eventstore server is running on localhost:1113 - // "EventStore.IsolationMode": "None", - // Process: start a process using Command/Arguments settings below - "EventStore.IsolationMode": "Process", - - // EventStore server process launch settings. - // -- local EventStore copy (Windows only): - "EventStore.Server.Command": "EventStoreServer/EventStore.ClusterNode.exe", - "EventStore.Server.Arguments": "--run-projections=all --start-standard-projections=true" - // -- dockerized instance (note: may leave EventStore running after tests finish): - // "EventStore.Server.Command": "docker", - // "EventStore.Server.Arguments": "run -it --rm --name eventstore-bulloak -p 2113:2113 -p 1113:1113 eventstore/eventstore:release-5.0.5" -}