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 3a7adde..e46b34b 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
@@ -24,6 +24,8 @@
+
+
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 a9943ee..0000000
--- a/src/BullOak.Repositories.EventStore.Test.Integration/Specification/ReadModelSpecs.feature.cs
+++ /dev/null
@@ -1,439 +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 static 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, featureTags);
- testRunner.OnFeatureStart(featureInfo);
- }
-
- public static void FeatureTearDown()
- {
- testRunner.OnFeatureEnd();
- testRunner = null;
- }
-
- public void TestInitialize()
- {
- }
-
- public void TestTearDown()
- {
- testRunner.OnScenarioEnd();
- }
-
- public void ScenarioInitialize(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
- {
- testRunner.OnScenarioInitialize(scenarioInfo);
- testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(_testOutputHelper);
- }
-
- public void ScenarioStart()
- {
- testRunner.OnScenarioStart();
- }
-
- public void ScenarioCleanup()
- {
- testRunner.CollectScenarioErrors();
- }
-
- public virtual void FeatureBackground()
- {
-#line 6
-#line hidden
-#line 7
- testRunner.Given("the grpc protocol is being used", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
- }
-
- 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 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, featureTags);
-#line 9
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 10
- testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 11
- testRunner.And("3 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 12
- 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 13
- testRunner.When("I load my entity through the read-only repository", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
-#line 14
- testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 15
- testRunner.And("HighOrder property should be 2", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 16
- testRunner.And("have a concurrency id of 2", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
- }
- this.ScenarioCleanup();
- }
-
- [Xunit.SkippableTheoryAttribute(DisplayName="Reconstitute state specifying optimization")]
- [Xunit.TraitAttribute("FeatureTitle", "ReadModelSpecs")]
- [Xunit.TraitAttribute("Description", "Reconstitute state specifying optimization")]
- [Xunit.InlineDataAttribute("true", new string[0])]
- [Xunit.InlineDataAttribute("false", new string[0])]
- public void ReconstituteStateSpecifyingOptimization(string optimize_For_Short_Streams, string[] exampleTags)
- {
- string[] tagsOfScenario = exampleTags;
- System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary();
- argumentsOfScenario.Add("optimize-for-short-streams", optimize_For_Short_Streams);
- TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Reconstitute state specifying optimization", null, tagsOfScenario, argumentsOfScenario, featureTags);
-#line 18
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 19
- testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 20
- testRunner.And("3 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 21
- 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 22
- testRunner.When(string.Format("I load my entity using optimization set to {0}", optimize_For_Short_Streams), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
-#line 23
- testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 24
- testRunner.And("HighOrder property should be 2", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 25
- 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 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, featureTags);
-#line 32
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 33
- 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 34
- testRunner.And("the following events with the following timestamps", ((string)(null)), table2, "And ");
-#line hidden
-#line 39
- 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 40
- 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 41
- testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 42
- 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 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, featureTags);
-#line 44
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 45
- testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#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 46
- testRunner.And("the following events with the following timestamps", ((string)(null)), table3, "And ");
-#line hidden
-#line 51
- 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 52
- testRunner.And("after waiting for 15 seconds for categories to be processed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 53
- testRunner.When("I load all my entities for the streams category", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
-#line 54
- testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 55
- 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 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, featureTags);
-#line 57
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 58
- testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 59
- testRunner.And("another new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "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-23 11:10:00"});
-#line 60
- testRunner.And("the following events with timestamps for stream 1", ((string)(null)), table4, "And ");
-#line hidden
- TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
- "Timestamp"});
- table5.AddRow(new string[] {
- "2020-09-10 11:10:00"});
- table5.AddRow(new string[] {
- "2020-09-20 11:10:00"});
- table5.AddRow(new string[] {
- "2020-09-20 12:10:00"});
- table5.AddRow(new string[] {
- "2020-09-20 12:20:00"});
- table5.AddRow(new string[] {
- "2020-09-23 11:10:00"});
-#line 65
- testRunner.And("the following events with timestamps for stream 2", ((string)(null)), table5, "And ");
-#line hidden
-#line 72
- 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 73
- testRunner.And("after waiting for 15 seconds for categories to be processed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 74
- 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 75
- testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 76
- testRunner.And("HighOrder property for stream 1 should be 1", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 77
- 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 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, featureTags);
-#line 79
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 80
- 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"});
-#line 81
- testRunner.And("the following events with the following timestamps", ((string)(null)), table6, "And ");
-#line hidden
-#line 84
- 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 85
- 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 86
- testRunner.And("after waiting for 15 seconds for categories to be processed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 87
- 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 88
- testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 89
- 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 35ffbbf..0000000
--- a/src/BullOak.Repositories.EventStore.Test.Integration/Specification/ReconstituteState.feature.cs
+++ /dev/null
@@ -1,464 +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 static 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, featureTags);
- testRunner.OnFeatureStart(featureInfo);
- }
-
- public static void FeatureTearDown()
- {
- testRunner.OnFeatureEnd();
- testRunner = null;
- }
-
- public void TestInitialize()
- {
- }
-
- public void TestTearDown()
- {
- testRunner.OnScenarioEnd();
- }
-
- public void ScenarioInitialize(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
- {
- testRunner.OnScenarioInitialize(scenarioInfo);
- testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(_testOutputHelper);
- }
-
- public void ScenarioStart()
- {
- testRunner.OnScenarioStart();
- }
-
- public void ScenarioCleanup()
- {
- testRunner.CollectScenarioErrors();
- }
-
- public virtual void FeatureBackground()
- {
-#line 6
-#line hidden
-#line 7
- testRunner.Given("the grpc protocol is being used", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
- }
-
- 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", "1", new string[0])]
- [Xunit.InlineDataAttribute("5", "4", "4", new string[0])]
- [Xunit.InlineDataAttribute("10000", "9999", "9999", new string[0])]
- public void LoadStoredEntityWithFromExistingEvents(string eventsCount, string expectedHighOrder, string expectedLastState, string[] exampleTags)
- {
- string[] tagsOfScenario = exampleTags;
- System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary();
- argumentsOfScenario.Add("eventsCount", eventsCount);
- argumentsOfScenario.Add("expectedHighOrder", expectedHighOrder);
- argumentsOfScenario.Add("expectedLastState", expectedLastState);
- TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Load stored entity with from existing events", null, tagsOfScenario, argumentsOfScenario, featureTags);
-#line 9
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 10
- testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 11
- testRunner.And(string.Format("{0} new events", eventsCount), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 12
- testRunner.When("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
-#line 13
- testRunner.And("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 14
- testRunner.Then(string.Format("HighOrder property should be {0}", expectedHighOrder), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 15
- testRunner.And(string.Format("LastState property should be {0}", expectedLastState), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
- }
- this.ScenarioCleanup();
- }
-
- [Xunit.SkippableFactAttribute(DisplayName="Load stream backwards - sanity check")]
- [Xunit.TraitAttribute("FeatureTitle", "ReconstituteState")]
- [Xunit.TraitAttribute("Description", "Load stream backwards - sanity check")]
- public void LoadStreamBackwards_SanityCheck()
- {
- string[] tagsOfScenario = ((string[])(null));
- System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary();
- TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Load stream backwards - sanity check", null, tagsOfScenario, argumentsOfScenario, featureTags);
-#line 23
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 24
- testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 25
- testRunner.And("4 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 26
- testRunner.And("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 27
- testRunner.When("I load my entity backwards", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
-#line 28
- testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 29
- testRunner.And("HighOrder property should be 3", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
- }
- this.ScenarioCleanup();
- }
-
- [Xunit.SkippableFactAttribute(DisplayName="Load stream forwards - sanity check")]
- [Xunit.TraitAttribute("FeatureTitle", "ReconstituteState")]
- [Xunit.TraitAttribute("Description", "Load stream forwards - sanity check")]
- public void LoadStreamForwards_SanityCheck()
- {
- string[] tagsOfScenario = ((string[])(null));
- System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary();
- TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Load stream forwards - sanity check", null, tagsOfScenario, argumentsOfScenario, featureTags);
-#line 31
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 32
- testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 33
- testRunner.And("4 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 34
- testRunner.And("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 35
- testRunner.When("I load my entity forwards", ((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 3", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#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 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, featureTags);
-#line 39
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 40
- testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 41
- testRunner.And("3 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 42
- 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 43
- testRunner.When("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
-#line 44
- testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 45
- 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 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, featureTags);
-#line 47
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 48
- testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
- TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] {
- "Timestamp"});
- table7.AddRow(new string[] {
- "2020-09-10 11:10:00"});
- table7.AddRow(new string[] {
- "2020-09-20 11:10:00"});
- table7.AddRow(new string[] {
- "2020-09-23 11:10:00"});
-#line 49
- testRunner.And("the following events with the following timestamps", ((string)(null)), table7, "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 my entity as of \'2020-09-22 11:10:00\'", ((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 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 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, featureTags);
-#line 59
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 60
- testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 61
- testRunner.When("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
-#line 62
- testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 63
- 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 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, featureTags);
-#line 65
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 66
- testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 67
- testRunner.And("3 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 68
- testRunner.And("I soft-delete the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 69
- testRunner.When("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
-#line 70
- testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 71
- 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 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, featureTags);
-#line 73
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 74
- testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 75
- testRunner.And("3 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 76
- testRunner.And("I hard-delete the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 77
- testRunner.When("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
-#line 78
- testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 79
- 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 d5c5d9c..0000000
--- a/src/BullOak.Repositories.EventStore.Test.Integration/Specification/SaveEventStream.feature.cs
+++ /dev/null
@@ -1,525 +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 static 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, featureTags);
- testRunner.OnFeatureStart(featureInfo);
- }
-
- public static void FeatureTearDown()
- {
- testRunner.OnFeatureEnd();
- testRunner = null;
- }
-
- public void TestInitialize()
- {
- }
-
- public void TestTearDown()
- {
- testRunner.OnScenarioEnd();
- }
-
- public void ScenarioInitialize(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
- {
- testRunner.OnScenarioInitialize(scenarioInfo);
- testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(_testOutputHelper);
- }
-
- public void ScenarioStart()
- {
- testRunner.OnScenarioStart();
- }
-
- public void ScenarioCleanup()
- {
- testRunner.CollectScenarioErrors();
- }
-
- public virtual void FeatureBackground()
- {
-#line 6
-#line hidden
-#line 7
- testRunner.Given("the grpc protocol is being used", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
- }
-
- 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 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, featureTags);
-#line 9
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 10
- testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 11
- testRunner.And(string.Format("{0} new events", eventsCount), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 12
- testRunner.When("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
-#line 13
- testRunner.Then("the save process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 14
- 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 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, featureTags);
-#line 21
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 22
- testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 23
- testRunner.And("1 new event", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 24
- 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 25
- 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 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, featureTags);
-#line 27
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 28
- testRunner.Given("an existing stream with 10 events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 29
- testRunner.And("10 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 30
- testRunner.When("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
-#line 31
- testRunner.Then("the save process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 32
- 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 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, featureTags);
-#line 34
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 35
- testRunner.Given("an existing stream with 10 events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 36
- testRunner.And("session \'Session1\' is open", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 37
- testRunner.And("session \'Session2\' is open", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 38
- testRunner.And("10 new events are added by \'Session1\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 39
- testRunner.And("10 new events are added by \'Session2\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 40
- testRunner.When("I try to save \'Session1\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
-#line 41
- testRunner.And("I try to save \'Session2\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 42
- testRunner.Then("the save process should succeed for \'Session1\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 43
- testRunner.And("the save process should fail for \'Session2\' with ConcurrencyException", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 44
- 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 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, featureTags);
-#line 46
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 47
- testRunner.Given("an existing stream with 10 events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 48
- testRunner.And("session \'Session1\' is open", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 49
- testRunner.And("10 new events are added by \'Session1\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 50
- testRunner.When("I try to save \'Session1\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
-#line 51
- testRunner.And("I try to save \'Session1\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 52
- testRunner.Then("the save process should fail for \'Session1\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 53
- 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 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, featureTags);
-#line 55
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 56
- testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 57
- testRunner.And("3 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 58
- testRunner.And("I hard-delete the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 59
- testRunner.And("10 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 60
- testRunner.When("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
-#line 61
- 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 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, featureTags);
-#line 63
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 64
- testRunner.Given("a new stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 65
- testRunner.And("3 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 66
- testRunner.And("I soft-delete the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 67
- testRunner.And("10 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 68
- testRunner.When("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
-#line 69
- testRunner.And("I load my entity", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 70
- testRunner.Then("the load process should succeed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 71
- testRunner.And("HighOrder property should be 9", ((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 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, featureTags);
-#line 73
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 74
- testRunner.Given("an always-fail invariant checker", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 75
- testRunner.And("an existing stream with 3 events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 76
- testRunner.And("5 new events", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 77
- testRunner.When("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
-#line 78
- testRunner.And("I load my entity ignoring any errors", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 79
- testRunner.Then("the save process should fail", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 80
- 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 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, featureTags);
-#line 82
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 83
- 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 84
- testRunner.And(string.Format("an existing stream with {0} events", existingCount), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 85
- testRunner.And(string.Format("{0} new events", newEventsCount), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 86
- testRunner.When("I try to save the new events in the stream", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line hidden
-#line 87
- testRunner.And("I load my entity ignoring any errors", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
-#line 88
- testRunner.Then(string.Format("the save process should {0}", outcome), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 89
- 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 6ebac4f..0000000
--- a/src/BullOak.Repositories.EventStore.Test.Integration/Specification/StateRetreivalSpecs.feature.cs
+++ /dev/null
@@ -1,157 +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 static 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, featureTags);
- testRunner.OnFeatureStart(featureInfo);
- }
-
- public static void FeatureTearDown()
- {
- testRunner.OnFeatureEnd();
- testRunner = null;
- }
-
- public void TestInitialize()
- {
- }
-
- public void TestTearDown()
- {
- testRunner.OnScenarioEnd();
- }
-
- public void ScenarioInitialize(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
- {
- testRunner.OnScenarioInitialize(scenarioInfo);
- testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(_testOutputHelper);
- }
-
- public void ScenarioStart()
- {
- testRunner.OnScenarioStart();
- }
-
- public void ScenarioCleanup()
- {
- testRunner.CollectScenarioErrors();
- }
-
- public virtual void FeatureBackground()
- {
-#line 6
-#line hidden
-#line 7
- testRunner.Given("the grpc protocol is being used", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
- }
-
- 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", "2", new string[0])]
- [Xunit.InlineDataAttribute("2", "3", "2", "2", new string[0])]
- [Xunit.InlineDataAttribute("7", "5", "6", "4", new string[0])]
- [Xunit.InlineDataAttribute("0", "10000", "9999", "9999", new string[0])]
- public void WhenIAddNewEventsInTheStreamIWantTheStateToBeUpdatedImmediately(string eventCount, string addedEvents, string highOrder, string lastState, 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);
- argumentsOfScenario.Add("lastState", lastState);
- 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, featureTags);
-#line 14
-this.ScenarioInitialize(scenarioInfo);
-#line hidden
- if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))
- {
- testRunner.SkipScenario();
- }
- else
- {
- this.ScenarioStart();
-#line 6
-this.FeatureBackground();
-#line hidden
-#line 15
- testRunner.Given(string.Format("an existing stream with {0} events", eventCount), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line hidden
-#line 16
- 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 17
- testRunner.Then(string.Format("HighOrder property should be {0}", highOrder), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line hidden
-#line 18
- testRunner.And(string.Format("LastState property should be {0}", lastState), ((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()
- {
- StateRetrievalSpecsFeature.FeatureSetup();
- }
-
- void System.IDisposable.Dispose()
- {
- StateRetrievalSpecsFeature.FeatureTearDown();
- }
- }
- }
-}
-#pragma warning restore
-#endregion
diff --git a/src/BullOak.Repositories.EventStore/BullOak.Repositories.EventStore.csproj b/src/BullOak.Repositories.EventStore/BullOak.Repositories.EventStore.csproj
index a2595e6..bb3a22a 100644
--- a/src/BullOak.Repositories.EventStore/BullOak.Repositories.EventStore.csproj
+++ b/src/BullOak.Repositories.EventStore/BullOak.Repositories.EventStore.csproj
@@ -50,5 +50,7 @@
+
+
diff --git a/src/BullOak.Repositories.EventStore/BullOak.Repositories.EventStore.csproj.DotSettings b/src/BullOak.Repositories.EventStore/BullOak.Repositories.EventStore.csproj.DotSettings
deleted file mode 100644
index 6162834..0000000
--- a/src/BullOak.Repositories.EventStore/BullOak.Repositories.EventStore.csproj.DotSettings
+++ /dev/null
@@ -1,2 +0,0 @@
-
- CSharp90
\ No newline at end of file
diff --git a/src/BullOak.Repositories.EventStore/Streams/GrpcEventWriter.cs b/src/BullOak.Repositories.EventStore/Streams/GrpcEventWriter.cs
index b208972..903105a 100644
--- a/src/BullOak.Repositories.EventStore/Streams/GrpcEventWriter.cs
+++ b/src/BullOak.Repositories.EventStore/Streams/GrpcEventWriter.cs
@@ -1,17 +1,24 @@
namespace BullOak.Repositories.EventStore.Streams;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-using Exceptions;
+using BullOak.Repositories.Exceptions;
using global::EventStore.Client;
using EventData = global::EventStore.Client.EventData;
+using Polly;
+using Polly.Retry;
public class GrpcEventWriter : IStoreEventsToStream
{
private readonly EventStoreClient client;
+ // TODO: Get this via .ctor dependency injection
+ private readonly AsyncRetryPolicy retryPolicy =
+ GrpcWriteRetryPolicy.GetRetryPolicy(GrpcWriteRetrySettings.DefaultRetrySettings);
+
public GrpcEventWriter(EventStoreClient client)
{
this.client = client;
@@ -55,29 +62,33 @@ private async Task AppendToStream
CancellationToken cancellationToken
)
{
- IWriteResult writeResult;
+ var result = await retryPolicy.ExecuteAndCaptureAsync(async () =>
+ revision == -1 ?
+ await client.AppendToStreamAsync(
+ streamId,
+ StreamState.NoStream,
+ eventsToAdd.Select(eventObject => eventObject.CreateV20EventData(dateTimeProvider)),
+ options => options.ThrowOnAppendFailure = false,
+ cancellationToken: cancellationToken)
+ .ConfigureAwait(false)
+ :
+ await client.AppendToStreamAsync(
+ streamId,
+ StreamRevision.FromInt64(revision),
+ eventsToAdd.Select(eventObject => eventObject.CreateV20EventData(dateTimeProvider)),
+ options => options.ThrowOnAppendFailure = false,
+ cancellationToken: cancellationToken)
+ .ConfigureAwait(false)
+ );
- if (revision == -1)
- {
- writeResult = await client.AppendToStreamAsync(
- streamId,
- StreamState.NoStream,
- eventsToAdd.Select(eventObject => eventObject.CreateV20EventData(dateTimeProvider)),
- options => options.ThrowOnAppendFailure = false,
- cancellationToken: cancellationToken)
- .ConfigureAwait(false);
- }
- else
+ if (result.Outcome != OutcomeType.Successful)
{
- writeResult = await client.AppendToStreamAsync(
- streamId,
- StreamRevision.FromInt64(revision),
- eventsToAdd.Select(eventObject => eventObject.CreateV20EventData(dateTimeProvider)),
- options => options.ThrowOnAppendFailure = false,
- cancellationToken: cancellationToken)
- .ConfigureAwait(false);
+ // TODO: Use more specific exception
+ throw new InvalidOperationException();
}
+ var writeResult = result.Result;
+
if (writeResult is WrongExpectedVersionResult)
throw new ConcurrencyException(streamId, null);
diff --git a/src/BullOak.Repositories.EventStore/Streams/GrpcWriteRetryPolicy.cs b/src/BullOak.Repositories.EventStore/Streams/GrpcWriteRetryPolicy.cs
new file mode 100644
index 0000000..e48cfc0
--- /dev/null
+++ b/src/BullOak.Repositories.EventStore/Streams/GrpcWriteRetryPolicy.cs
@@ -0,0 +1,17 @@
+using Grpc.Core;
+using Polly;
+using Polly.Contrib.WaitAndRetry;
+using Polly.Retry;
+
+namespace BullOak.Repositories.EventStore.Streams;
+
+public static class GrpcWriteRetryPolicy
+{
+ public static AsyncRetryPolicy GetRetryPolicy(GrpcWriteRetrySettings retrySettings) =>
+ Policy
+ .Handle()
+ .Or(e => retrySettings.RetryableStatusCodes.Contains(e.StatusCode))
+ .WaitAndRetryAsync(
+ Backoff.DecorrelatedJitterBackoffV2(retrySettings.IntervalDelta, retrySettings.Limit, fastFirst: retrySettings.FastFirst),
+ (ex, timespan, context) => retrySettings.OnRetry(ex, timespan, context));
+}
diff --git a/src/BullOak.Repositories.EventStore/Streams/GrpcWriteRetrySettings.cs b/src/BullOak.Repositories.EventStore/Streams/GrpcWriteRetrySettings.cs
new file mode 100644
index 0000000..2936944
--- /dev/null
+++ b/src/BullOak.Repositories.EventStore/Streams/GrpcWriteRetrySettings.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using Grpc.Core;
+
+namespace BullOak.Repositories.EventStore.Streams;
+
+public class GrpcWriteRetrySettings
+{
+ public TimeSpan IntervalDelta { get; }
+ public int Limit { get; }
+ public bool FastFirst { get; }
+
+ public HashSet RetryableStatusCodes { get; }
+
+ public Action OnRetry { get; init; }
+
+ private GrpcWriteRetrySettings(
+ TimeSpan intervalDelta,
+ int limit,
+ bool fastFirst = true,
+ HashSet retryableStatusCodes = null,
+ Action onRetry = null)
+ {
+ IntervalDelta = intervalDelta;
+ Limit = limit;
+ FastFirst = fastFirst;
+ RetryableStatusCodes = retryableStatusCodes ?? new HashSet();
+ OnRetry = onRetry ?? NoOp;
+ }
+
+ // With default settings we will only retry on NotLeaderException
+ public static GrpcWriteRetrySettings DefaultRetrySettings = new(TimeSpan.FromMilliseconds(200), 5);
+
+ private static Action NoOp => (_, _, _) => { };
+}