From 67445279fba719985be503722f6e62acd69d4f6e Mon Sep 17 00:00:00 2001 From: stidsborg Date: Sat, 9 Dec 2023 10:44:15 +0100 Subject: [PATCH] Removed Scrapbook work extensions --- .../AtLeastOnceWorkStatusAndResultTests.cs | 4 - .../AtLeastOnceWorkStatusTests.cs | 4 - .../AtMostOnceWorkStatusAndResultTests.cs | 4 - .../AtMostOnceWorkStatusTests.cs | 4 - .../AtLeastOnceWorkStatusAndResultTests.cs | 73 +-- .../AtLeastOnceWorkStatusTests.cs | 54 +-- .../AtMostOnceWorkStatusAndResultTests.cs | 97 ++-- .../AtMostOnceWorkStatusTests.cs | 58 +-- .../Domain/Activity.cs | 16 + .../Domain/ExistingActivities.cs | 16 + .../Domain/RScrapbookExtensions.cs | 454 ------------------ .../BankTransfer/TransferSagaV1.cs | 4 +- .../BankTransfer/TransferSagaV2.cs | 5 +- .../Engagement/EngagementReminderSaga.cs | 6 +- .../FraudDetection/MessagingApproach/Saga.cs | 2 +- .../Sample.ConsoleApp/SupportTicket/Saga.cs | 2 +- .../Sample.ConsoleApp/TravelAgency/Saga.cs | 4 +- .../Rpc/OrderProcessor.cs | 4 +- .../AtLeastOnceWorkStatusAndResultTests.cs | 4 - .../AtLeastOnceWorkStatusTests.cs | 4 - .../AtMostOnceWorkStatusAndResultTests.cs | 6 +- .../AtMostOnceWorkStatusTests.cs | 4 - .../AtLeastOnceWorkStatusAndResultTests.cs | 4 - .../AtLeastOnceWorkStatusTests.cs | 4 - .../AtMostOnceWorkStatusAndResultTests.cs | 4 - .../AtMostOnceWorkStatusTests.cs | 4 - .../AtLeastOnceWorkStatusAndResultTests.cs | 4 - .../AtLeastOnceWorkStatusTests.cs | 4 - .../AtMostOnceWorkStatusAndResultTests.cs | 4 - .../AtMostOnceWorkStatusTests.cs | 4 - .../AtLeastOnceWorkStatusAndResultTests.cs | 5 - .../AtLeastOnceWorkStatusTests.cs | 4 - .../AtMostOnceWorkStatusAndResultTests.cs | 4 - .../AtMostOnceWorkStatusTests.cs | 4 - 34 files changed, 145 insertions(+), 733 deletions(-) delete mode 100644 Core/Cleipnir.ResilientFunctions/Domain/RScrapbookExtensions.cs diff --git a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs index c0b9c18f..527f8ac5 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs @@ -25,8 +25,4 @@ public override Task CompletedAtLeastOnceWorkIsNotExecutedMultipleTimes() [TestMethod] public override Task CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes() => CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes(Utils.CreateInMemoryFunctionStoreTask()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(Utils.CreateInMemoryFunctionStoreTask()); } \ No newline at end of file diff --git a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/AtLeastOnceWorkStatusTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/AtLeastOnceWorkStatusTests.cs index d88d4e70..2640287d 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/AtLeastOnceWorkStatusTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/AtLeastOnceWorkStatusTests.cs @@ -21,8 +21,4 @@ public override Task CompletedAtLeastOnceWorkIsNotExecutedMultipleTimes() [TestMethod] public override Task CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes() => CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes(Utils.CreateInMemoryFunctionStoreTask()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(Utils.CreateInMemoryFunctionStoreTask()); } \ No newline at end of file diff --git a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs index 354bba7a..fefea82b 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs @@ -29,8 +29,4 @@ public override Task CompletedAtMostOnceWorkWithCallIdIsNotExecutedMultipleTimes [TestMethod] public override Task CompletedAtMostOnceWorkWithCallIdAndGenericResultIsNotExecutedMultipleTimes() => CompletedAtMostOnceWorkWithCallIdAndGenericResultIsNotExecutedMultipleTimes(Utils.CreateInMemoryFunctionStoreTask()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(Utils.CreateInMemoryFunctionStoreTask()); } \ No newline at end of file diff --git a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/AtMostOnceWorkStatusTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/AtMostOnceWorkStatusTests.cs index 2b114d0d..e11f0b3f 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/AtMostOnceWorkStatusTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/AtMostOnceWorkStatusTests.cs @@ -17,8 +17,4 @@ public override Task AtMostOnceWorkWithCallIdIsNotExecutedMultipleTimes() [TestMethod] public override Task CompletedAtMostOnceWorkIsNotExecutedMultipleTimes() => CompletedAtMostOnceWorkIsNotExecutedMultipleTimes(Utils.CreateInMemoryFunctionStoreTask()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(Utils.CreateInMemoryFunctionStoreTask()); } \ No newline at end of file diff --git a/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs index 2b091833..9d1c2978 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs @@ -24,11 +24,11 @@ public async Task AtLeastOnceWorkIsExecutedMultipleTimesWhenNotCompleted(Task + async Task(string param, Context context) => { - await scrapbook - .DoAtLeastOnce( - workStatus: s => s.WorkStatus, + await context.Activity + .Do( + "id", work: () => { counter.Increment(); @@ -48,7 +48,7 @@ await BusyWait.Until(() => ); var controlPanel = await rAction.ControlPanel(functionInstanceId); - controlPanel!.Scrapbook.WorkStatus.Result.ShouldBe(1); + controlPanel!.Activities.SelectAsync(a => a.GetValue("id")).Result.ShouldBe(1); counter.Current.ShouldBe(2); } @@ -63,11 +63,11 @@ public async Task AtLeastOnceWorkWithCallIdIsExecutedMultipleTimesWhenNotComplet var rFunc = rFunctions.RegisterFunc( functionTypeId, - async Task(string param, Scrapbook scrapbook) => + async Task(string param, Context context) => { - return await scrapbook - .DoAtLeastOnce( - workId: "someId", + return await context.Activity + .Do( + "someId", work: () => { counter.Increment(); @@ -103,11 +103,11 @@ public async Task AtLeastOnceWorkWithCallIdAndGenericResultIsExecutedMultipleTim var rFunc = rFunctions.RegisterFunc( functionTypeId, - async Task(string param, Scrapbook scrapbook) => + async Task(string param, Context context) => { - return await scrapbook - .DoAtLeastOnce( - workId: "someId", + return await context.Activity + .Do( + "someId", work: () => { counter.Increment(); @@ -146,12 +146,13 @@ public async Task CompletedAtLeastOnceWorkIsNotExecutedMultipleTimes(Task + async Task(string param, Context context) => { - await scrapbook - .DoAtLeastOnce( - workStatus: s => s.WorkStatus, - work: () => { counter.Increment(); return 1.ToTask(); }); + await context.Activity + .Do( + "id", + work: () => { counter.Increment(); return 1.ToTask(); } + ); }); await rAction.Invoke(functionInstanceId.ToString(), "hello"); @@ -172,11 +173,11 @@ public async Task CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes(T var rAction = rFunctions.RegisterAction( functionTypeId, - async Task(string param, Scrapbook scrapbook) => + async Task(string param, Context context) => { - await scrapbook - .DoAtLeastOnce( - workId: "someId", + await context.Activity + .Do( + "someId", work: () => { counter.Increment(); return "hello world".ToTask(); } ); }); @@ -188,32 +189,8 @@ await scrapbook await controlPanel.ReInvoke(); await controlPanel.Refresh(); - var value = controlPanel.Scrapbook.StateDictionary["someId"]; - var splitValue = value.Split(","); - splitValue[0].ShouldBe(WorkStatus.Completed.ToString()); - splitValue[1].ShouldBe("hello world"); + var value = await controlPanel.Activities.SelectAsync(a => a.GetValue("someId")); + value.ShouldBe("hello world"); counter.Current.ShouldBe(1); } - - public abstract Task ReferencingGetOnlyPropertyThrowsException(); - public async Task ReferencingGetOnlyPropertyThrowsException(Task storeTask) - { - var scrapbook = new ScrapbookGetterOnly(); - await Should.ThrowAsync(() => - scrapbook.DoAtMostOnce( - workStatus: s => s.WorkStatus, - work: () => 1.ToTask() - ) - ); - } - - private class Scrapbook : RScrapbook - { - public Work WorkStatus { get; set; } - } - - private class ScrapbookGetterOnly : RScrapbook - { - public Work WorkStatus { get; } = new(); - } } \ No newline at end of file diff --git a/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/AtLeastOnceWorkStatusTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/AtLeastOnceWorkStatusTests.cs index 7999ce60..2849f1b9 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/AtLeastOnceWorkStatusTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/AtLeastOnceWorkStatusTests.cs @@ -24,11 +24,11 @@ public async Task AtLeastOnceWorkIsExecutedMultipleTimesWhenNotCompleted(Task + async Task(string param, Context context) => { - await scrapbook - .DoAtLeastOnce( - workStatus: s => s.WorkStatus, + await context.Activity + .Do( + "Id", work: () => { counter.Increment(); @@ -60,11 +60,11 @@ public async Task AtLeastOnceWorkWithCallIdIsExecutedMultipleTimesWhenNotComplet var rAction = rFunctions.RegisterAction( functionTypeId, - async Task(string param, Scrapbook scrapbook) => + async Task(string param, Context context) => { - await scrapbook - .DoAtLeastOnce( - workId: "someId", + await context.Activity + .Do( + "someId", work: () => { counter.Increment(); @@ -96,11 +96,11 @@ public async Task CompletedAtLeastOnceWorkIsNotExecutedMultipleTimes(Task + async Task(string param, Context context) => { - await scrapbook - .DoAtLeastOnce( - workStatus: s => s.WorkStatus, + await context.Activity + .Do( + "Id", work: () => { counter.Increment(); return Task.CompletedTask; }); }); @@ -121,11 +121,11 @@ public async Task CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes(T var rAction = rFunctions.RegisterAction( functionTypeId, - async Task(string param, Scrapbook scrapbook) => + async Task(string param, Context context) => { - await scrapbook - .DoAtLeastOnce( - workId: "someId", + await context.Activity + .Do( + "someId", work: () => { counter.Increment(); return Task.CompletedTask; }); }); @@ -134,26 +134,4 @@ await scrapbook counter.Current.ShouldBe(1); } - - public abstract Task ReferencingGetOnlyPropertyThrowsException(); - public async Task ReferencingGetOnlyPropertyThrowsException(Task functionStoreTask) - { - var scrapbook = new ScrapbookGetterOnly(); - await Should.ThrowAsync(() => - scrapbook.DoAtMostOnce( - workStatus: s => s.WorkStatus, - work: () => Task.CompletedTask - ) - ); - } - - private class Scrapbook : RScrapbook - { - public WorkStatus WorkStatus { get; set; } - } - - private class ScrapbookGetterOnly : RScrapbook - { - public WorkStatus WorkStatus { get; } = WorkStatus.NotStarted; - } } \ No newline at end of file diff --git a/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs index 4738ae76..ed7a5058 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs @@ -25,16 +25,16 @@ public async Task AtMostOnceWorkIsNotExecutedMultipleTimes(Task var rAction = rFunctions.RegisterAction( functionTypeId, - async Task(string param, Scrapbook scrapbook) => + async Task(string param, Context context) => { - await scrapbook - .DoAtMostOnce( - workStatus: s => s.WorkStatus, + await context.Activity + .Do( + "id", work: () => { counter.Increment(); throw new PostponeInvocationException(1); - } + }, ResiliencyLevel.AtMostOnce ); }); @@ -59,11 +59,11 @@ public async Task AtMostOnceWorkWithCallIdIsNotExecutedMultipleTimes(Task + async Task(string param, Context context) => { - await scrapbook - .DoAtMostOnce( - workId: "someId", + await context.Activity + .Do( + "someId", work: () => { counter.Increment(); @@ -71,7 +71,7 @@ await scrapbook throw new PostponeInvocationException(1); return "hello world".ToTask(); - } + }, ResiliencyLevel.AtMostOnce ); }); @@ -96,11 +96,11 @@ public async Task AtMostOnceWorkWithCallIdAndGenericResultIsNotExecutedMultipleT var rAction = rFunctions.RegisterAction( functionTypeId, - async Task(string param, Scrapbook scrapbook) => + async Task(string param, Context context) => { - await scrapbook - .DoAtMostOnce( - workId: "someId", + await context.Activity + .Do( + "someId", work: () => { counter.Increment(); @@ -108,7 +108,7 @@ await scrapbook throw new PostponeInvocationException(1); return new Person("Peter", 32).ToTask(); - } + }, ResiliencyLevel.AtMostOnce ); }); @@ -135,12 +135,13 @@ public async Task CompletedAtMostOnceWorkIsNotExecutedMultipleTimes(Task + async Task(string param, Context context) => { - await scrapbook - .DoAtMostOnce( - workStatus: s => s.WorkStatus, - work: () => { counter.Increment(); return 1.ToTask(); } + await context.Activity + .Do( + "id", + work: () => { counter.Increment(); return 1.ToTask(); }, + ResiliencyLevel.AtMostOnce ); }); @@ -161,12 +162,13 @@ public async Task CompletedAtMostOnceWorkWithCallIdIsNotExecutedMultipleTimes(Ta var rAction = rFunctions.RegisterAction( functionTypeId, - async Task(string param, Scrapbook scrapbook) => + async Task(string param, Context context) => { - await scrapbook - .DoAtMostOnce( - workId: "someId", - work: () => { counter.Increment(); return "hello world".ToTask(); } + await context.Activity + .Do( + "someId", + work: () => { counter.Increment(); return "hello world".ToTask(); }, + ResiliencyLevel.AtMostOnce ); }); @@ -179,10 +181,8 @@ await scrapbook counter.Current.ShouldBe(1); await controlPanel.Refresh(); - var value = controlPanel.Scrapbook.StateDictionary["someId"]; - var splitValue = value.Split(","); - splitValue[0].ShouldBe(WorkStatus.Completed.ToString()); - splitValue[1].ShouldBe("hello world"); + var value = await controlPanel.Activities.SelectAsync(a => a.GetValue("someId")); + value.ShouldBe("hello world"); } public abstract Task CompletedAtMostOnceWorkWithCallIdAndGenericResultIsNotExecutedMultipleTimes(); @@ -196,12 +196,13 @@ public async Task CompletedAtMostOnceWorkWithCallIdAndGenericResultIsNotExecuted var rAction = rFunctions.RegisterAction( functionTypeId, - async Task(string param, Scrapbook scrapbook) => + async Task(string param, Context context) => { - await scrapbook - .DoAtMostOnce( - workId: "someId", - work: () => { counter.Increment(); return new Person("Peter", 32).ToTask(); } + await context.Activity + .Do( + "someId", + work: () => { counter.Increment(); return new Person("Peter", 32).ToTask(); }, + ResiliencyLevel.AtMostOnce ); }); @@ -214,31 +215,7 @@ await scrapbook counter.Current.ShouldBe(1); await controlPanel.Refresh(); - var value = controlPanel.Scrapbook.StateDictionary["someId"]; - var deserialized = JsonSerializer.Deserialize>(value); - deserialized.Status.ShouldBe(WorkStatus.Completed); - deserialized.Result.ShouldBe(new Person("Peter", 32)); - } - - public abstract Task ReferencingGetOnlyPropertyThrowsException(); - public async Task ReferencingGetOnlyPropertyThrowsException(Task functionStoreTask) - { - var scrapbook = new ScrapbookGetterOnly(); - await Should.ThrowAsync(() => - scrapbook.DoAtMostOnce( - workStatus: s => s.WorkStatus, - work: () => 1.ToTask() - ) - ); - } - - private class Scrapbook : RScrapbook - { - public Work WorkStatus { get; set; } - } - - private class ScrapbookGetterOnly : RScrapbook - { - public Work WorkStatus { get; } = new(); + var value = await controlPanel.Activities.SelectAsync(a => a.GetValue("someId")); + value.ShouldBe(new Person("Peter", 32)); } } \ No newline at end of file diff --git a/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/AtMostOnceWorkStatusTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/AtMostOnceWorkStatusTests.cs index 6d4340d5..32688119 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/AtMostOnceWorkStatusTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/AtMostOnceWorkStatusTests.cs @@ -4,7 +4,6 @@ using Cleipnir.ResilientFunctions.Domain; using Cleipnir.ResilientFunctions.Domain.Exceptions; using Cleipnir.ResilientFunctions.Helpers; -using Cleipnir.ResilientFunctions.Reactive.Utilities; using Cleipnir.ResilientFunctions.Storage; using Cleipnir.ResilientFunctions.Tests.Utils; using Shouldly; @@ -24,16 +23,16 @@ public async Task AtMostOnceWorkIsNotExecutedMultipleTimes(Task var rAction = rFunctions.RegisterAction( functionTypeId, - async Task(string param, Scrapbook scrapbook) => + async Task(string param, Context context) => { - await scrapbook - .DoAtMostOnce( - workStatus: s => s.WorkStatus, + await context.Activity + .Do( + "Id", work: () => { counter.Increment(); throw new PostponeInvocationException(1); - } + }, ResiliencyLevel.AtMostOnce ); }); @@ -58,16 +57,16 @@ public async Task AtMostOnceWorkWithCallIdIsNotExecutedMultipleTimes(Task + async Task(string param, Context context) => { - await scrapbook - .DoAtMostOnce( - workId: "someId", + await context.Activity + .Do( + "someId", work: () => { counter.Increment(); throw new PostponeInvocationException(1); - } + }, ResiliencyLevel.AtMostOnce ); }); @@ -92,12 +91,17 @@ public async Task CompletedAtMostOnceWorkIsNotExecutedMultipleTimes(Task + async Task(string param, Context context) => { - await scrapbook - .DoAtMostOnce( - workStatus: s => s.WorkStatus, - work: () => { counter.Increment(); return Task.CompletedTask; }); + await context.Activity + .Do( + id: "id", + work: () => + { + counter.Increment(); + return Task.CompletedTask; + }, ResiliencyLevel.AtMostOnce + ); }); await rAction.Invoke(functionInstanceId.ToString(), "hello"); @@ -105,26 +109,4 @@ await scrapbook counter.Current.ShouldBe(1); } - - public abstract Task ReferencingGetOnlyPropertyThrowsException(); - public async Task ReferencingGetOnlyPropertyThrowsException(Task functionStoreTask) - { - var scrapbook = new ScrapbookGetterOnly(); - await Should.ThrowAsync(() => - scrapbook.DoAtMostOnce( - workStatus: s => s.WorkStatus, - work: () => Task.CompletedTask - ) - ); - } - - private class Scrapbook : RScrapbook - { - public WorkStatus WorkStatus { get; set; } - } - - private class ScrapbookGetterOnly : RScrapbook - { - public WorkStatus WorkStatus { get; } = WorkStatus.NotStarted; - } } \ No newline at end of file diff --git a/Core/Cleipnir.ResilientFunctions/Domain/Activity.cs b/Core/Cleipnir.ResilientFunctions/Domain/Activity.cs index ba18326e..3e37eccf 100644 --- a/Core/Cleipnir.ResilientFunctions/Domain/Activity.cs +++ b/Core/Cleipnir.ResilientFunctions/Domain/Activity.cs @@ -65,6 +65,14 @@ await _activityStore.SetActivityResult( { await work(); } + catch (PostponeInvocationException) + { + throw; + } + catch (SuspendInvocationException) + { + throw; + } catch (Exception exception) { var storedException = _serializer.SerializeException(exception); @@ -111,6 +119,14 @@ await _activityStore.SetActivityResult( { result = await work(); } + catch (PostponeInvocationException) + { + throw; + } + catch (SuspendInvocationException) + { + throw; + } catch (Exception exception) { var storedException = _serializer.SerializeException(exception); diff --git a/Core/Cleipnir.ResilientFunctions/Domain/ExistingActivities.cs b/Core/Cleipnir.ResilientFunctions/Domain/ExistingActivities.cs index 3a9cc7d6..bb8757fd 100644 --- a/Core/Cleipnir.ResilientFunctions/Domain/ExistingActivities.cs +++ b/Core/Cleipnir.ResilientFunctions/Domain/ExistingActivities.cs @@ -23,6 +23,22 @@ public ExistingActivities(FunctionId functionId, Dictionary All => _storedActivities; + public bool HasValue(string id) => _storedActivities.ContainsKey(id); + public TResult? GetValue(string id) + { + var success = _storedActivities.TryGetValue(id, out var storedActivity); + if (!success) + throw new KeyNotFoundException($"Activity '{id}' was not found in existing activities"); + if (storedActivity!.WorkStatus != WorkStatus.Completed) + throw new InvalidOperationException($"Activity '{id}' has not completed (but has status '{storedActivity.WorkStatus}')"); + + return storedActivity.Result == null + ? default + : _serializer.DeserializeActivityResult(_storedActivities[id].Result!); + } + + + public async Task Remove(string id) { await _activityStore.DeleteActivityResult(_functionId, id); diff --git a/Core/Cleipnir.ResilientFunctions/Domain/RScrapbookExtensions.cs b/Core/Cleipnir.ResilientFunctions/Domain/RScrapbookExtensions.cs deleted file mode 100644 index fbb594e0..00000000 --- a/Core/Cleipnir.ResilientFunctions/Domain/RScrapbookExtensions.cs +++ /dev/null @@ -1,454 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Reflection; -using System.Text.Json; -using System.Threading.Tasks; - -namespace Cleipnir.ResilientFunctions.Domain; - -public static class RScrapbookExtensions -{ - private static readonly object Sync = new(); - private static readonly Dictionary GetterAndSetters = new(); - - public static async Task DoAtMostOnce( - this RScrapbook scrapbook, - string workId, - Func work, - bool flushCompletedStatusImmediately = true) - { - { - using var _ = await scrapbook.Lock(); - if (scrapbook.StateDictionary.ContainsKey(workId)) - { - var value = scrapbook.StateDictionary[workId]; - var success = Enum.TryParse(value, ignoreCase: true, out var workStatus); - if (!success) - throw new InvalidOperationException($"Current value '{value}' could not be converted to {nameof(WorkStatus)} enum"); - - if (workStatus == WorkStatus.Completed) return; - if (workStatus == WorkStatus.Started) - throw new InvalidOperationException("Previous work was started but not completed"); - } - - scrapbook.StateDictionary[workId] = WorkStatus.Started.ToString(); - await scrapbook.Save(); - } - - await work(); - - using var __ = await scrapbook.Lock(); - scrapbook.StateDictionary[workId] = WorkStatus.Completed.ToString(); - if (flushCompletedStatusImmediately) - await scrapbook.Save(); - } - - public static async Task DoAtMostOnce( - this RScrapbook scrapbook, - string workId, - Func> work, - bool flushCompletedStatusImmediately = true) - { - { - using var _ = await scrapbook.Lock(); - if (scrapbook.StateDictionary.ContainsKey(workId)) - { - var value = scrapbook.StateDictionary[workId]; - var firstComma = value.IndexOf(','); - var first = value[..firstComma]; - var second = value[(firstComma + 1)..]; - var success = Enum.TryParse(first, ignoreCase: true, out var workStatus); - if (!success) - throw new InvalidOperationException($"Current value '{value}' could not be converted to {nameof(WorkStatus)} enum"); - - if (workStatus == WorkStatus.Completed) return second; - if (workStatus == WorkStatus.Started) - throw new InvalidOperationException("Previous work was started but not completed"); - } - - scrapbook.StateDictionary[workId] = $"{WorkStatus.Started},"; - await scrapbook.Save(); - } - - var result = await work(); - - using var __ = await scrapbook.Lock(); - scrapbook.StateDictionary[workId] = $"{WorkStatus.Completed},{result}"; - if (flushCompletedStatusImmediately) - await scrapbook.Save(); - - return result; - } - - public static async Task DoAtMostOnce( - this TScrapbook scrapbook, - Expression> workStatus, - Func work, - bool flushCompletedStatusImmediately = true) where TScrapbook : RScrapbook - { - var getterAndSetter = GetOrCreateGetterAndSetter(workStatus); - var getter = (Func)getterAndSetter.Getter; - var setter = (Action)getterAndSetter.Setter; - - { - using var _ = await scrapbook.Lock(); - var workStatusValue = getter(scrapbook); - if (workStatusValue == WorkStatus.Completed) return; - if (workStatusValue == WorkStatus.Started) - throw new InvalidOperationException("Previous work was started but not completed"); - setter(scrapbook, WorkStatus.Started); - await scrapbook.Save(); - } - - await work(); - - using var __ = await scrapbook.Lock(); - setter(scrapbook, WorkStatus.Completed); - if (flushCompletedStatusImmediately) - await scrapbook.Save(); - } - - public static async Task DoAtMostOnce( - this TScrapbook scrapbook, - Expression>> workStatus, - Func> work, - bool flushCompletedStatusImmediately = true) where TScrapbook : RScrapbook - { - var getterAndSetter = GetOrCreateGetterAndSetter(workStatus); - var getter = (Func>)getterAndSetter.Getter; - var setter = (Action>)getterAndSetter.Setter; - - { - using var _ = await scrapbook.Lock(); - var workStatusValue = getter(scrapbook); - if (workStatusValue.Status == WorkStatus.Completed) return workStatusValue.Result; - if (workStatusValue.Status == WorkStatus.Started) - throw new InvalidOperationException("Previous work was started but not completed"); - setter(scrapbook, new Work() { Status = WorkStatus.Started }); - await scrapbook.Save(); - } - - var result = await work(); - - using var __ = await scrapbook.Lock(); - setter(scrapbook, new Work { Status = WorkStatus.Completed, Result = result }); - if (flushCompletedStatusImmediately) - await scrapbook.Save(); - - return result; - } - - public static async Task DoAtMostOnce( - this RScrapbook scrapbook, - string workId, - Func> work, - bool flushCompletedStatusImmediately = true) - { - { - using var _ = await scrapbook.Lock(); - if (scrapbook.StateDictionary.ContainsKey(workId)) - { - var (status, previousResult) = JsonSerializer.Deserialize>(scrapbook.StateDictionary[workId]); - - if (status == WorkStatus.Completed) return previousResult!; - if (status == WorkStatus.Started) - throw new InvalidOperationException($"Previous work '{workId}' was started but not completed"); - } - - scrapbook.StateDictionary[workId] = JsonSerializer.Serialize( - new Work - { - Status = WorkStatus.Started, - Result = default! - }); - await scrapbook.Save(); - } - - var result = await work(); - - using var __ = await scrapbook.Lock(); - - scrapbook.StateDictionary[workId] = JsonSerializer.Serialize( - new Work - { - Status = WorkStatus.Completed, - Result = result - }); - - if (flushCompletedStatusImmediately) - await scrapbook.Save(); - - return result; - } - - public static async Task DoAtLeastOnce( - this RScrapbook scrapbook, - string workId, - Func work, - bool flushCompletedStatusImmediately = true) - { - { - using var _ = await scrapbook.Lock(); - if (scrapbook.StateDictionary.ContainsKey(workId)) - { - var value = scrapbook.StateDictionary[workId]; - var success = Enum.TryParse(value, ignoreCase: true, out var workStatus); - if (!success) - throw new InvalidOperationException($"Current value '{value}' could not be converted to {nameof(WorkStatus)} enum"); - - if (workStatus == WorkStatus.Completed) return; - } - - scrapbook.StateDictionary[workId] = WorkStatus.Started.ToString(); - } - - await work(); - - using var __ = await scrapbook.Lock(); - scrapbook.StateDictionary[workId] = WorkStatus.Completed.ToString(); - if (flushCompletedStatusImmediately) - await scrapbook.Save(); - } - - public static async Task DoAtLeastOnce( - this RScrapbook scrapbook, - string workId, - Func> work, - bool flushCompletedStatusImmediately = true) - { - { - using var _ = await scrapbook.Lock(); - if (scrapbook.StateDictionary.ContainsKey(workId)) - { - var value = scrapbook.StateDictionary[workId]; - var firstComma = value.IndexOf(','); - var first = value[..firstComma]; - var second = value[(firstComma + 1)..]; - var success = Enum.TryParse(first, ignoreCase: true, out var workStatus); - if (!success) - throw new InvalidOperationException($"Current value '{value}' could not be converted to {nameof(WorkStatus)} enum"); - - if (workStatus == WorkStatus.Completed) return second; - } - - scrapbook.StateDictionary[workId] = $"{WorkStatus.Started},"; - } - - var result = await work(); - - using var __ = await scrapbook.Lock(); - scrapbook.StateDictionary[workId] = $"{WorkStatus.Completed},{result}"; - if (flushCompletedStatusImmediately) - await scrapbook.Save(); - - return result; - } - - public static async Task DoAtLeastOnce( - this RScrapbook scrapbook, - string workId, - Func> work, - bool flushCompletedStatusImmediately = true) - { - { - using var _ = await scrapbook.Lock(); - if (scrapbook.StateDictionary.ContainsKey(workId)) - { - var (status, previousResult) = JsonSerializer.Deserialize>(scrapbook.StateDictionary[workId]); - - if (status == WorkStatus.Completed) return previousResult!; - } - - scrapbook.StateDictionary[workId] = JsonSerializer.Serialize( - new Work - { - Status = WorkStatus.Started, - Result = default! - }); - } - - var result = await work(); - - using var __ = await scrapbook.Lock(); - - scrapbook.StateDictionary[workId] = JsonSerializer.Serialize( - new Work - { - Status = WorkStatus.Completed, - Result = result - }); - - if (flushCompletedStatusImmediately) - await scrapbook.Save(); - - return result; - } - - public static async Task DoAtLeastOnce( - this TScrapbook scrapbook, - Expression> workStatus, - Func work, - bool flushCompletedStatusImmediately = true) where TScrapbook : RScrapbook - { - var getterAndSetter = GetOrCreateGetterAndSetter(workStatus); - var getter = (Func)getterAndSetter.Getter; - var setter = (Action)getterAndSetter.Setter; - - { - using var _ = await scrapbook.Lock(); - var workStatusValue = getter(scrapbook); - if (workStatusValue == WorkStatus.Completed) return; - - setter(scrapbook, WorkStatus.Started); - } - - await work(); - - using var __ = await scrapbook.Lock(); - setter(scrapbook, WorkStatus.Completed); - if (flushCompletedStatusImmediately) await scrapbook.Save(); - } - - public static async Task DoAtLeastOnce( - this TScrapbook scrapbook, - Expression>> workStatus, - Func> work, - bool flushCompletedStatusImmediately = true) where TScrapbook : RScrapbook - { - var getterAndSetter = GetOrCreateGetterAndSetter(workStatus); - var getter = (Func>)getterAndSetter.Getter; - var setter = (Action>)getterAndSetter.Setter; - - { - using var _ = await scrapbook.Lock(); - var workStatusValue = getter(scrapbook); - if (workStatusValue.Status == WorkStatus.Completed) - return workStatusValue.Result; - - setter(scrapbook, new Work { Status = WorkStatus.Started }); - } - - var result = await work(); - - using var __ = await scrapbook.Lock(); - setter(scrapbook, new Work { Status = WorkStatus.Completed, Result = result }); - if (flushCompletedStatusImmediately) await scrapbook.Save(); - - return result; - } - - private static GetterAndSetter GetOrCreateGetterAndSetter(Expression> property) - { - //fast-path - var existingGetterAndSetter = GetExistingGetterAndSetter(property); - if (existingGetterAndSetter != null) - return existingGetterAndSetter; - - //slow-path - var propertyInfo = GetPropertyInfoAndValidatePropertyExpression(property); - - //generate getter and setter delegates - var getter = propertyInfo.GetMethod!.CreateDelegate(typeof(Func)); - var setter = propertyInfo.SetMethod!.CreateDelegate(typeof(Action)); - var getterAndSetter = new GetterAndSetter(getter, setter); - lock (Sync) - GetterAndSetters[propertyInfo] = getterAndSetter; - - return getterAndSetter; - } - - private static GetterAndSetter? GetExistingGetterAndSetter(Expression> propertyLambda) - { - var member = propertyLambda.Body as MemberExpression; - if (member == null) return null; - - var propInfo = member.Member as PropertyInfo; - if (propInfo == null) return null; - - lock (Sync) - if (GetterAndSetters.ContainsKey(propInfo)) - return GetterAndSetters[propInfo]; - - return null; - } - - private static PropertyInfo GetPropertyInfoAndValidatePropertyExpression(Expression> propertyLambda) - { - var member = propertyLambda.Body as MemberExpression; - if (member == null) - throw new ArgumentException($"Expression '{propertyLambda}' must refer to a property of type {nameof(WorkStatus)}"); - - var propInfo = member.Member as PropertyInfo; - if (propInfo == null) - throw new ArgumentException($"Expression '{propertyLambda}' must refer to a property of type {nameof(WorkStatus)}"); - - var type = typeof(TScrapbook); - if (type != propInfo.ReflectedType) - throw new ArgumentException($"Expression '{propertyLambda}' must refer to a property of type {nameof(WorkStatus)}"); - if (propInfo.SetMethod == null) - throw new ArgumentException($"Expression '{propertyLambda}' must refer to a settable property"); - if (propInfo.GetMethod == null) - throw new ArgumentException($"Expression '{propertyLambda}' must refer to a gettable property"); - - return propInfo; - } - - private static GetterAndSetter GetOrCreateGetterAndSetter(Expression>> property) - { - //fast-path - var existingGetterAndSetter = GetExistingGetterAndSetter(property); - if (existingGetterAndSetter != null) - return existingGetterAndSetter; - - //slow-path - var propertyInfo = GetPropertyInfoAndValidatePropertyExpression(property); - - //generate getter and setter delegates - var getter = propertyInfo.GetMethod!.CreateDelegate(typeof(Func>)); - var setter = propertyInfo.SetMethod!.CreateDelegate(typeof(Action>)); - var getterAndSetter = new GetterAndSetter(getter, setter); - lock (Sync) - GetterAndSetters[propertyInfo] = getterAndSetter; - - return getterAndSetter; - } - - private static GetterAndSetter? GetExistingGetterAndSetter(Expression>> propertyLambda) - { - var member = propertyLambda.Body as MemberExpression; - if (member == null) return null; - - var propInfo = member.Member as PropertyInfo; - if (propInfo == null) return null; - - lock (Sync) - if (GetterAndSetters.ContainsKey(propInfo)) - return GetterAndSetters[propInfo]; - - return null; - } - - private static PropertyInfo GetPropertyInfoAndValidatePropertyExpression(Expression>> propertyLambda) - { - var member = propertyLambda.Body as MemberExpression; - if (member == null) - throw new ArgumentException($"Expression '{propertyLambda}' must refer to a property of type {nameof(Work)}"); - - var propInfo = member.Member as PropertyInfo; - if (propInfo == null) - throw new ArgumentException($"Expression '{propertyLambda}' must refer to a property of type {nameof(Work)}"); - - var type = typeof(TScrapbook); - if (type != propInfo.ReflectedType) - throw new ArgumentException($"Expression '{propertyLambda}' must refer to a property of type {nameof(Work)}"); - if (propInfo.SetMethod == null) - throw new ArgumentException($"Expression '{propertyLambda}' must refer to a settable property"); - if (propInfo.GetMethod == null) - throw new ArgumentException($"Expression '{propertyLambda}' must refer to a gettable property"); - - return propInfo; - } - - private record GetterAndSetter(object Getter, object Setter); -} \ No newline at end of file diff --git a/Samples/Sample.ConsoleApp/BankTransfer/TransferSagaV1.cs b/Samples/Sample.ConsoleApp/BankTransfer/TransferSagaV1.cs index 0e9cd0ba..798de354 100644 --- a/Samples/Sample.ConsoleApp/BankTransfer/TransferSagaV1.cs +++ b/Samples/Sample.ConsoleApp/BankTransfer/TransferSagaV1.cs @@ -35,12 +35,12 @@ public async Task Perform(Transfer transfer, RScrapbook scrapbook, Context conte var success = await arbitrator.Propose("BankTransfer", transfer.TransferId.ToString(), value: "V1"); if (!success) throw new InvalidOperationException("Other version was selected for execution"); - var deductTask = scrapbook.DoAtMostOnce( + var deductTask = context.Activity.Do( "DeductAmount", () => BankCentralClient.PostTransaction(transfer.FromAccountTransactionId, transfer.FromAccount, -transfer.Amount) ); - var addTask = scrapbook.DoAtMostOnce( + var addTask = context.Activity.Do( "AddAmount", () => BankCentralClient.PostTransaction(transfer.ToAccountTransactionId, transfer.ToAccount, transfer.Amount) ); diff --git a/Samples/Sample.ConsoleApp/BankTransfer/TransferSagaV2.cs b/Samples/Sample.ConsoleApp/BankTransfer/TransferSagaV2.cs index 6d6a8c54..c62dcb80 100644 --- a/Samples/Sample.ConsoleApp/BankTransfer/TransferSagaV2.cs +++ b/Samples/Sample.ConsoleApp/BankTransfer/TransferSagaV2.cs @@ -32,15 +32,16 @@ public class Inner public async Task Perform(Transfer transfer, RScrapbook scrapbook, Context context) { var arbitrator = context.Utilities.Arbitrator; + var (activity, eventSource) = context; var success = await arbitrator.Propose("BankTransfer", transfer.TransferId.ToString(), value: "V1"); if (!success) throw new InvalidOperationException("Other version was selected for execution"); - var deductTask = scrapbook.DoAtMostOnce( + var deductTask = activity.Do( "DeductAmount", () => BankCentralClient.PostTransaction(transfer.FromAccountTransactionId, transfer.FromAccount, -transfer.Amount) ); - var addTask = scrapbook.DoAtMostOnce( + var addTask = activity.Do( "AddAmount", () => BankCentralClient.PostTransaction(transfer.ToAccountTransactionId, transfer.ToAccount, transfer.Amount) ); diff --git a/Samples/Sample.ConsoleApp/Engagement/EngagementReminderSaga.cs b/Samples/Sample.ConsoleApp/Engagement/EngagementReminderSaga.cs index 4619e522..58414e0d 100644 --- a/Samples/Sample.ConsoleApp/Engagement/EngagementReminderSaga.cs +++ b/Samples/Sample.ConsoleApp/Engagement/EngagementReminderSaga.cs @@ -14,8 +14,8 @@ public static async Task Start(StartCustomerEngagement startEngagement, RScrapbo var (candidateEmail, nextReminderTime) = startEngagement; var es = context.EventSource; - await scrapbook.DoAtLeastOnce( - workId: "InitialCorrespondence", + await context.Activity.Do( + "InitialCorrespondence", SendEngagementInitialCorrespondence ); @@ -39,7 +39,7 @@ await scrapbook.DoAtLeastOnce( // if accepted notify hr and complete the flow if (either.Match(ea => true, er => false)) { - await scrapbook.DoAtLeastOnce(workId: "NotifyHR", work: () => NotifyHR(candidateEmail)); + await context.Activity.Do("NotifyHR", work: () => NotifyHR(candidateEmail)); await es.CancelTimeoutEvent(timeoutId: i.ToString()); return; diff --git a/Samples/Sample.ConsoleApp/FraudDetection/MessagingApproach/Saga.cs b/Samples/Sample.ConsoleApp/FraudDetection/MessagingApproach/Saga.cs index cd5d063f..d2e1d4b9 100644 --- a/Samples/Sample.ConsoleApp/FraudDetection/MessagingApproach/Saga.cs +++ b/Samples/Sample.ConsoleApp/FraudDetection/MessagingApproach/Saga.cs @@ -22,7 +22,7 @@ public static async Task StartFraudDetection(Transaction transaction, RScrapbook var approved = results.Count >= 2 && results.All(result => result.Approved); - await scrapbook.DoAtMostOnce( + await context.Activity.Do( "PublishTransactionApproval", () => MessageBroker.Send(approved ? new TransactionApproved(transaction) diff --git a/Samples/Sample.ConsoleApp/SupportTicket/Saga.cs b/Samples/Sample.ConsoleApp/SupportTicket/Saga.cs index 5fb9df50..782ea8ce 100644 --- a/Samples/Sample.ConsoleApp/SupportTicket/Saga.cs +++ b/Samples/Sample.ConsoleApp/SupportTicket/Saga.cs @@ -15,7 +15,7 @@ public static async Task AcceptSupportTicket(SupportTicketRequest request, RScra var agents = request.CustomerSupportAgents.Length; for (var i = 0; ; i++) { - await scrapbook.DoAtLeastOnce("SendTakeSupportTicketRequest", async () => + await context.Activity.Do("SendTakeSupportTicketRequest", async () => { var customerSupportAgentEmail = request.CustomerSupportAgents[i % agents]; await MessageBroker.Send( diff --git a/Samples/Sample.ConsoleApp/TravelAgency/Saga.cs b/Samples/Sample.ConsoleApp/TravelAgency/Saga.cs index f2cae875..480a4deb 100644 --- a/Samples/Sample.ConsoleApp/TravelAgency/Saga.cs +++ b/Samples/Sample.ConsoleApp/TravelAgency/Saga.cs @@ -13,8 +13,8 @@ public static async Task BookTravel(BookingRequest bookingRequest, RScrapbook sc var eventSource = context.EventSource; var (bookingId, customerId, amount, details) = bookingRequest; - await scrapbook.DoAtMostOnce( - workId: "SendRequests", + await context.Activity.Do( + "SendRequests", async () => { await MessageBroker.Send(new BookFlight(bookingId, customerId, details)); diff --git a/Samples/Sample.OrderProcessing/Rpc/OrderProcessor.cs b/Samples/Sample.OrderProcessing/Rpc/OrderProcessor.cs index a6911cb8..598ccb98 100644 --- a/Samples/Sample.OrderProcessing/Rpc/OrderProcessor.cs +++ b/Samples/Sample.OrderProcessing/Rpc/OrderProcessor.cs @@ -23,8 +23,8 @@ public async Task ProcessOrder(Order order, Scrapbook scrapbook, Context context await _paymentProviderClient.Reserve(order.CustomerId, scrapbook.TransactionId, order.TotalPrice); - var trackAndTrace = await scrapbook.DoAtMostOnce( - workStatus: s => s.ProductsShippedStatus, + var trackAndTrace = await context.Activity.Do( + "ShipProducts", work: () => _logisticsClient.ShipProducts(order.CustomerId, order.ProductIds) ); diff --git a/Stores/AzureBlob/Cleipnir.ResilientFunctions.AzureBlob.Tests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs b/Stores/AzureBlob/Cleipnir.ResilientFunctions.AzureBlob.Tests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs index d37ed7e1..68d13160 100644 --- a/Stores/AzureBlob/Cleipnir.ResilientFunctions.AzureBlob.Tests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs +++ b/Stores/AzureBlob/Cleipnir.ResilientFunctions.AzureBlob.Tests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs @@ -22,10 +22,6 @@ public override Task CompletedAtLeastOnceWorkIsNotExecutedMultipleTimes() public override Task CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes() => CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(FunctionStoreFactory.Create()); - [TestMethod] public override Task AtLeastOnceWorkWithCallIdAndGenericResultIsExecutedMultipleTimesWhenNotCompleted() => AtLeastOnceWorkWithCallIdAndGenericResultIsExecutedMultipleTimesWhenNotCompleted(FunctionStoreFactory.Create()); diff --git a/Stores/AzureBlob/Cleipnir.ResilientFunctions.AzureBlob.Tests/RFunctionTests/AtLeastOnceWorkStatusTests.cs b/Stores/AzureBlob/Cleipnir.ResilientFunctions.AzureBlob.Tests/RFunctionTests/AtLeastOnceWorkStatusTests.cs index 0bfa25b8..6b373b78 100644 --- a/Stores/AzureBlob/Cleipnir.ResilientFunctions.AzureBlob.Tests/RFunctionTests/AtLeastOnceWorkStatusTests.cs +++ b/Stores/AzureBlob/Cleipnir.ResilientFunctions.AzureBlob.Tests/RFunctionTests/AtLeastOnceWorkStatusTests.cs @@ -21,8 +21,4 @@ public override Task CompletedAtLeastOnceWorkIsNotExecutedMultipleTimes() [TestMethod] public override Task CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes() => CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(FunctionStoreFactory.Create()); } \ No newline at end of file diff --git a/Stores/AzureBlob/Cleipnir.ResilientFunctions.AzureBlob.Tests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs b/Stores/AzureBlob/Cleipnir.ResilientFunctions.AzureBlob.Tests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs index 08d2b8ff..8ae3a731 100644 --- a/Stores/AzureBlob/Cleipnir.ResilientFunctions.AzureBlob.Tests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs +++ b/Stores/AzureBlob/Cleipnir.ResilientFunctions.AzureBlob.Tests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs @@ -21,11 +21,7 @@ public override Task CompletedAtMostOnceWorkIsNotExecutedMultipleTimes() [TestMethod] public override Task CompletedAtMostOnceWorkWithCallIdIsNotExecutedMultipleTimes() => CompletedAtMostOnceWorkWithCallIdIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(FunctionStoreFactory.Create()); - + [TestMethod] public override Task AtMostOnceWorkWithCallIdAndGenericResultIsNotExecutedMultipleTimes() => AtMostOnceWorkWithCallIdAndGenericResultIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); diff --git a/Stores/AzureBlob/Cleipnir.ResilientFunctions.AzureBlob.Tests/RFunctionTests/AtMostOnceWorkStatusTests.cs b/Stores/AzureBlob/Cleipnir.ResilientFunctions.AzureBlob.Tests/RFunctionTests/AtMostOnceWorkStatusTests.cs index 6eb72d0d..4cdc9b52 100644 --- a/Stores/AzureBlob/Cleipnir.ResilientFunctions.AzureBlob.Tests/RFunctionTests/AtMostOnceWorkStatusTests.cs +++ b/Stores/AzureBlob/Cleipnir.ResilientFunctions.AzureBlob.Tests/RFunctionTests/AtMostOnceWorkStatusTests.cs @@ -17,8 +17,4 @@ public override Task AtMostOnceWorkWithCallIdIsNotExecutedMultipleTimes() [TestMethod] public override Task CompletedAtMostOnceWorkIsNotExecutedMultipleTimes() => CompletedAtMostOnceWorkIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(FunctionStoreFactory.Create()); } \ No newline at end of file diff --git a/Stores/MySQL/Cleipnir.ResilientFunctions.MySQL.Tests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs b/Stores/MySQL/Cleipnir.ResilientFunctions.MySQL.Tests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs index b0b04d8b..db226f08 100644 --- a/Stores/MySQL/Cleipnir.ResilientFunctions.MySQL.Tests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs +++ b/Stores/MySQL/Cleipnir.ResilientFunctions.MySQL.Tests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs @@ -24,8 +24,4 @@ public override Task CompletedAtLeastOnceWorkIsNotExecutedMultipleTimes() [TestMethod] public override Task CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes() => CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(FunctionStoreFactory.Create()); } \ No newline at end of file diff --git a/Stores/MySQL/Cleipnir.ResilientFunctions.MySQL.Tests/RFunctionTests/AtLeastOnceWorkStatusTests.cs b/Stores/MySQL/Cleipnir.ResilientFunctions.MySQL.Tests/RFunctionTests/AtLeastOnceWorkStatusTests.cs index d70f99bc..0cd958b7 100644 --- a/Stores/MySQL/Cleipnir.ResilientFunctions.MySQL.Tests/RFunctionTests/AtLeastOnceWorkStatusTests.cs +++ b/Stores/MySQL/Cleipnir.ResilientFunctions.MySQL.Tests/RFunctionTests/AtLeastOnceWorkStatusTests.cs @@ -20,8 +20,4 @@ public override Task CompletedAtLeastOnceWorkIsNotExecutedMultipleTimes() [TestMethod] public override Task CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes() => CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(FunctionStoreFactory.Create()); } \ No newline at end of file diff --git a/Stores/MySQL/Cleipnir.ResilientFunctions.MySQL.Tests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs b/Stores/MySQL/Cleipnir.ResilientFunctions.MySQL.Tests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs index fed26834..8a6dbad9 100644 --- a/Stores/MySQL/Cleipnir.ResilientFunctions.MySQL.Tests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs +++ b/Stores/MySQL/Cleipnir.ResilientFunctions.MySQL.Tests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs @@ -28,8 +28,4 @@ public override Task CompletedAtMostOnceWorkIsNotExecutedMultipleTimes() [TestMethod] public override Task CompletedAtMostOnceWorkWithCallIdIsNotExecutedMultipleTimes() => CompletedAtMostOnceWorkWithCallIdIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(FunctionStoreFactory.Create()); } \ No newline at end of file diff --git a/Stores/MySQL/Cleipnir.ResilientFunctions.MySQL.Tests/RFunctionTests/AtMostOnceWorkStatusTests.cs b/Stores/MySQL/Cleipnir.ResilientFunctions.MySQL.Tests/RFunctionTests/AtMostOnceWorkStatusTests.cs index 08f1d31f..8e045c00 100644 --- a/Stores/MySQL/Cleipnir.ResilientFunctions.MySQL.Tests/RFunctionTests/AtMostOnceWorkStatusTests.cs +++ b/Stores/MySQL/Cleipnir.ResilientFunctions.MySQL.Tests/RFunctionTests/AtMostOnceWorkStatusTests.cs @@ -16,8 +16,4 @@ public override Task AtMostOnceWorkWithCallIdIsNotExecutedMultipleTimes() [TestMethod] public override Task CompletedAtMostOnceWorkIsNotExecutedMultipleTimes() => CompletedAtMostOnceWorkIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(FunctionStoreFactory.Create()); } \ No newline at end of file diff --git a/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs b/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs index 0ab89366..3e24a802 100644 --- a/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs +++ b/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs @@ -25,8 +25,4 @@ public override Task CompletedAtLeastOnceWorkIsNotExecutedMultipleTimes() [TestMethod] public override Task CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes() => CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(FunctionStoreFactory.Create()); } \ No newline at end of file diff --git a/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/RFunctionTests/AtLeastOnceWorkStatusTests.cs b/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/RFunctionTests/AtLeastOnceWorkStatusTests.cs index aee43a0e..8cecc0e0 100644 --- a/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/RFunctionTests/AtLeastOnceWorkStatusTests.cs +++ b/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/RFunctionTests/AtLeastOnceWorkStatusTests.cs @@ -21,8 +21,4 @@ public override Task CompletedAtLeastOnceWorkIsNotExecutedMultipleTimes() [TestMethod] public override Task CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes() => CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(FunctionStoreFactory.Create()); } \ No newline at end of file diff --git a/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs b/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs index c314b059..bda291d3 100644 --- a/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs +++ b/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs @@ -22,10 +22,6 @@ public override Task CompletedAtMostOnceWorkIsNotExecutedMultipleTimes() public override Task CompletedAtMostOnceWorkWithCallIdIsNotExecutedMultipleTimes() => CompletedAtMostOnceWorkWithCallIdIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(FunctionStoreFactory.Create()); - [TestMethod] public override Task AtMostOnceWorkWithCallIdAndGenericResultIsNotExecutedMultipleTimes() => AtMostOnceWorkWithCallIdAndGenericResultIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); diff --git a/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/RFunctionTests/AtMostOnceWorkStatusTests.cs b/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/RFunctionTests/AtMostOnceWorkStatusTests.cs index 983d0f77..555df6c1 100644 --- a/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/RFunctionTests/AtMostOnceWorkStatusTests.cs +++ b/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/RFunctionTests/AtMostOnceWorkStatusTests.cs @@ -17,8 +17,4 @@ public override Task AtMostOnceWorkWithCallIdIsNotExecutedMultipleTimes() [TestMethod] public override Task CompletedAtMostOnceWorkIsNotExecutedMultipleTimes() => CompletedAtMostOnceWorkIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(FunctionStoreFactory.Create()); } \ No newline at end of file diff --git a/Stores/SqlServer/Cleipnir.ResilientFunctions.SqlServer.Tests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs b/Stores/SqlServer/Cleipnir.ResilientFunctions.SqlServer.Tests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs index a9790b46..9598d04b 100644 --- a/Stores/SqlServer/Cleipnir.ResilientFunctions.SqlServer.Tests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs +++ b/Stores/SqlServer/Cleipnir.ResilientFunctions.SqlServer.Tests/RFunctionTests/AtLeastOnceWorkStatusAndResultTests.cs @@ -21,11 +21,6 @@ public override Task CompletedAtLeastOnceWorkIsNotExecutedMultipleTimes() [TestMethod] public override Task CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes() => CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(FunctionStoreFactory.Create()); - [TestMethod] public override Task AtLeastOnceWorkWithCallIdAndGenericResultIsExecutedMultipleTimesWhenNotCompleted() => AtLeastOnceWorkWithCallIdAndGenericResultIsExecutedMultipleTimesWhenNotCompleted(FunctionStoreFactory.Create()); diff --git a/Stores/SqlServer/Cleipnir.ResilientFunctions.SqlServer.Tests/RFunctionTests/AtLeastOnceWorkStatusTests.cs b/Stores/SqlServer/Cleipnir.ResilientFunctions.SqlServer.Tests/RFunctionTests/AtLeastOnceWorkStatusTests.cs index b7084e04..2a6d515f 100644 --- a/Stores/SqlServer/Cleipnir.ResilientFunctions.SqlServer.Tests/RFunctionTests/AtLeastOnceWorkStatusTests.cs +++ b/Stores/SqlServer/Cleipnir.ResilientFunctions.SqlServer.Tests/RFunctionTests/AtLeastOnceWorkStatusTests.cs @@ -21,8 +21,4 @@ public override Task CompletedAtLeastOnceWorkIsNotExecutedMultipleTimes() [TestMethod] public override Task CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes() => CompletedAtLeastOnceWorkWithCallIdIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(FunctionStoreFactory.Create()); } \ No newline at end of file diff --git a/Stores/SqlServer/Cleipnir.ResilientFunctions.SqlServer.Tests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs b/Stores/SqlServer/Cleipnir.ResilientFunctions.SqlServer.Tests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs index b1abb079..0095a069 100644 --- a/Stores/SqlServer/Cleipnir.ResilientFunctions.SqlServer.Tests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs +++ b/Stores/SqlServer/Cleipnir.ResilientFunctions.SqlServer.Tests/RFunctionTests/AtMostOnceWorkStatusAndResultTests.cs @@ -21,10 +21,6 @@ public override Task CompletedAtMostOnceWorkIsNotExecutedMultipleTimes() [TestMethod] public override Task CompletedAtMostOnceWorkWithCallIdIsNotExecutedMultipleTimes() => CompletedAtMostOnceWorkWithCallIdIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(FunctionStoreFactory.Create()); [TestMethod] public override Task AtMostOnceWorkWithCallIdAndGenericResultIsNotExecutedMultipleTimes() diff --git a/Stores/SqlServer/Cleipnir.ResilientFunctions.SqlServer.Tests/RFunctionTests/AtMostOnceWorkStatusTests.cs b/Stores/SqlServer/Cleipnir.ResilientFunctions.SqlServer.Tests/RFunctionTests/AtMostOnceWorkStatusTests.cs index a92325f7..6300a1ff 100644 --- a/Stores/SqlServer/Cleipnir.ResilientFunctions.SqlServer.Tests/RFunctionTests/AtMostOnceWorkStatusTests.cs +++ b/Stores/SqlServer/Cleipnir.ResilientFunctions.SqlServer.Tests/RFunctionTests/AtMostOnceWorkStatusTests.cs @@ -17,8 +17,4 @@ public override Task AtMostOnceWorkWithCallIdIsNotExecutedMultipleTimes() [TestMethod] public override Task CompletedAtMostOnceWorkIsNotExecutedMultipleTimes() => CompletedAtMostOnceWorkIsNotExecutedMultipleTimes(FunctionStoreFactory.Create()); - - [TestMethod] - public override Task ReferencingGetOnlyPropertyThrowsException() - => ReferencingGetOnlyPropertyThrowsException(FunctionStoreFactory.Create()); } \ No newline at end of file