diff --git a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/EffectStoreTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/EffectStoreTests.cs index 5f1903cb..12da8805 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/EffectStoreTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/EffectStoreTests.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using Cleipnir.ResilientFunctions.Helpers; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Cleipnir.ResilientFunctions.Tests.InMemoryTests; @@ -8,25 +9,25 @@ public class EffectStoreTests : Cleipnir.ResilientFunctions.Tests.TestTemplates. { [TestMethod] public override Task SunshineScenarioTest() - => SunshineScenarioTest(FunctionStoreFactory.CreateEffectStore()); + => SunshineScenarioTest(FunctionStoreFactory.Create().SelectAsync(fs => fs.EffectsStore)); [TestMethod] public override Task SingleEffectWithResultLifeCycle() - => SingleEffectWithResultLifeCycle(FunctionStoreFactory.CreateEffectStore()); + => SingleEffectWithResultLifeCycle(FunctionStoreFactory.Create().SelectAsync(fs => fs.EffectsStore)); [TestMethod] public override Task SingleFailingEffectLifeCycle() - => SingleFailingEffectLifeCycle(FunctionStoreFactory.CreateEffectStore()); + => SingleFailingEffectLifeCycle(FunctionStoreFactory.Create().SelectAsync(fs => fs.EffectsStore)); [TestMethod] public override Task EffectCanBeDeleted() - => EffectCanBeDeleted(FunctionStoreFactory.CreateEffectStore()); + => EffectCanBeDeleted(FunctionStoreFactory.Create().SelectAsync(fs => fs.EffectsStore)); [TestMethod] public override Task DeleteFunctionIdDeletesAllRelatedEffects() - => DeleteFunctionIdDeletesAllRelatedEffects(FunctionStoreFactory.CreateEffectStore()); + => DeleteFunctionIdDeletesAllRelatedEffects(FunctionStoreFactory.Create().SelectAsync(fs => fs.EffectsStore)); [TestMethod] public override Task TruncateDeletesAllEffects() - => TruncateDeletesAllEffects(FunctionStoreFactory.CreateEffectStore()); + => TruncateDeletesAllEffects(FunctionStoreFactory.Create().SelectAsync(fs => fs.EffectsStore)); } \ No newline at end of file diff --git a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/FunctionStoreFactory.cs b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/FunctionStoreFactory.cs index f5ba029f..00a18ec5 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/FunctionStoreFactory.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/FunctionStoreFactory.cs @@ -8,7 +8,4 @@ public static class FunctionStoreFactory { public static Task Create() => new InMemoryFunctionStore().CastTo().ToTask(); - - public static Task CreateEffectStore() - => Create().SelectAsync(fs => fs.EffectsStore); } \ No newline at end of file diff --git a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/DoubleInvocationTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/DoubleInvocationTests.cs index 9475d2fc..e4b33a5b 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/DoubleInvocationTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/DoubleInvocationTests.cs @@ -10,17 +10,17 @@ public class DoubleInvocationTests : Cleipnir.ResilientFunctions.Tests.TestTempl { [TestMethod] public override Task SecondInvocationWaitsForAndReturnsSuccessfulResult() - => SecondInvocationWaitsForAndReturnsSuccessfulResult(new InMemoryFunctionStore().CastTo().ToTask()); + => SecondInvocationWaitsForAndReturnsSuccessfulResult(FunctionStoreFactory.Create()); [TestMethod] public override Task SecondInvocationFailsOnSuspendedFlow() - => SecondInvocationFailsOnSuspendedFlow(new InMemoryFunctionStore().CastTo().ToTask()); + => SecondInvocationFailsOnSuspendedFlow(FunctionStoreFactory.Create()); [TestMethod] public override Task SecondInvocationFailsOnPostponedFlow() - => SecondInvocationFailsOnPostponedFlow(new InMemoryFunctionStore().CastTo().ToTask()); + => SecondInvocationFailsOnPostponedFlow(FunctionStoreFactory.Create()); [TestMethod] public override Task SecondInvocationFailsOnFailedFlow() - => SecondInvocationFailsOnFailedFlow(new InMemoryFunctionStore().CastTo().ToTask()); + => SecondInvocationFailsOnFailedFlow(FunctionStoreFactory.Create()); } \ No newline at end of file diff --git a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/EffectTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/EffectTests.cs index c1bc17ef..542bbb60 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/EffectTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/EffectTests.cs @@ -10,41 +10,41 @@ public class EffectTests : Cleipnir.ResilientFunctions.Tests.TestTemplates.RFunc { [TestMethod] public override Task SunshineActionTest() - => SunshineActionTest(new InMemoryFunctionStore().CastTo().ToTask()); + => SunshineActionTest(FunctionStoreFactory.Create()); [TestMethod] public override Task SunshineAsyncActionTest() - => SunshineAsyncActionTest(new InMemoryFunctionStore().CastTo().ToTask()); + => SunshineAsyncActionTest(FunctionStoreFactory.Create()); [TestMethod] public override Task SunshineFuncTest() - => SunshineFuncTest(new InMemoryFunctionStore().CastTo().ToTask()); + => SunshineFuncTest(FunctionStoreFactory.Create()); [TestMethod] public override Task SunshineAsyncFuncTest() - => SunshineAsyncFuncTest(new InMemoryFunctionStore().CastTo().ToTask()); + => SunshineAsyncFuncTest(FunctionStoreFactory.Create()); [TestMethod] public override Task ExceptionThrowingActionTest() - => ExceptionThrowingActionTest(new InMemoryFunctionStore().CastTo().ToTask()); + => ExceptionThrowingActionTest(FunctionStoreFactory.Create()); [TestMethod] public override Task TaskWhenAnyFuncTest() - => TaskWhenAnyFuncTest(new InMemoryFunctionStore().CastTo().ToTask()); + => TaskWhenAnyFuncTest(FunctionStoreFactory.Create()); [TestMethod] public override Task TaskWhenAllFuncTest() - => TaskWhenAllFuncTest(new InMemoryFunctionStore().CastTo().ToTask()); + => TaskWhenAllFuncTest(FunctionStoreFactory.Create()); [TestMethod] public override Task ClearEffectsTest() - => ClearEffectsTest(new InMemoryFunctionStore().CastTo().ToTask()); + => ClearEffectsTest(FunctionStoreFactory.Create()); [TestMethod] public override Task EffectsCrudTest() - => EffectsCrudTest(new InMemoryFunctionStore().CastTo().ToTask()); + => EffectsCrudTest(FunctionStoreFactory.Create()); [TestMethod] public override Task ExistingEffectsFuncIsOnlyInvokedAfterGettingValue() - => ExistingEffectsFuncIsOnlyInvokedAfterGettingValue(new InMemoryFunctionStore().CastTo().ToTask()); + => ExistingEffectsFuncIsOnlyInvokedAfterGettingValue(FunctionStoreFactory.Create()); } \ No newline at end of file diff --git a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/TimeoutStoreTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/TimeoutStoreTests.cs index 36965317..a9d4408c 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/TimeoutStoreTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/TimeoutStoreTests.cs @@ -10,31 +10,31 @@ public class TimeoutStoreTests : TestTemplates.TimeoutStoreTests { [TestMethod] public override Task TimeoutCanBeCreatedFetchedAndRemoveSuccessfully() - => TimeoutCanBeCreatedFetchedAndRemoveSuccessfully(new InMemoryTimeoutStore().CastTo().ToTask()); + => TimeoutCanBeCreatedFetchedAndRemoveSuccessfully(FunctionStoreFactory.Create().SelectAsync(fs => fs.TimeoutStore)); [TestMethod] public override Task ExistingTimeoutCanUpdatedSuccessfully() - => ExistingTimeoutCanUpdatedSuccessfully(new InMemoryTimeoutStore().CastTo().ToTask()); + => ExistingTimeoutCanUpdatedSuccessfully(FunctionStoreFactory.Create().SelectAsync(fs => fs.TimeoutStore)); [TestMethod] public override Task OverwriteFalseDoesNotAffectExistingTimeout() - => OverwriteFalseDoesNotAffectExistingTimeout(new InMemoryTimeoutStore().CastTo().ToTask()); + => OverwriteFalseDoesNotAffectExistingTimeout(FunctionStoreFactory.Create().SelectAsync(fs => fs.TimeoutStore)); [TestMethod] public override Task RegisteredTimeoutIsReturnedFromRegisteredTimeouts() - => RegisteredTimeoutIsReturnedFromRegisteredTimeouts(new InMemoryTimeoutStore().CastTo().ToTask()); + => RegisteredTimeoutIsReturnedFromRegisteredTimeouts(FunctionStoreFactory.Create().SelectAsync(fs => fs.TimeoutStore)); [TestMethod] public override Task TimeoutStoreCanBeInitializedMultipleTimes() - => TimeoutStoreCanBeInitializedMultipleTimes(new InMemoryTimeoutStore().CastTo().ToTask()); + => TimeoutStoreCanBeInitializedMultipleTimes(FunctionStoreFactory.Create().SelectAsync(fs => fs.TimeoutStore)); [TestMethod] public override Task RegisteredTimeoutIsReturnedFromRegisteredTimeoutsForFunctionId() - => RegisteredTimeoutIsReturnedFromRegisteredTimeoutsForFunctionId(new InMemoryTimeoutStore().CastTo().ToTask()); + => RegisteredTimeoutIsReturnedFromRegisteredTimeoutsForFunctionId(FunctionStoreFactory.Create().SelectAsync(fs => fs.TimeoutStore)); [TestMethod] public override Task TimeoutIsNotRegisteredAgainWhenProviderAlreadyContainsTimeout() - => TimeoutIsNotRegisteredAgainWhenProviderAlreadyContainsTimeout(new InMemoryTimeoutStore().CastTo().ToTask()); + => TimeoutIsNotRegisteredAgainWhenProviderAlreadyContainsTimeout(FunctionStoreFactory.Create().SelectAsync(fs => fs.TimeoutStore)); [TestMethod] public override Task CancellingNonExistingTimeoutDoesNotResultInIO()