From db402c36e6ef28df19ebdbc5cffe16f5789422f2 Mon Sep 17 00:00:00 2001 From: skwasjer <11424653+skwasjer@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:45:20 +0100 Subject: [PATCH] fix(CA1711)!: rename OnException to OnError and ExceptionContext to ErrorContext. --- Migration.md | 2 + .../{ExceptionContext.cs => ErrorContext.cs} | 18 +++---- .../IAsyncCorrelationManager.cs | 8 +-- .../ICorrelationManager.cs | 8 +-- src/Correlate.Abstractions/OnError.cs | 15 ++++++ src/Correlate.Abstractions/OnException.cs | 13 ----- src/Correlate.Core/CorrelationManager.cs | 54 ++++++++++--------- .../AsyncCorrelationManagerExtensions.cs | 15 +++--- .../CorrelationManagerExtensions.cs | 15 +++--- .../CorrelationManagerTests.cs | 24 ++++----- 10 files changed, 89 insertions(+), 83 deletions(-) rename src/Correlate.Abstractions/{ExceptionContext.cs => ErrorContext.cs} (70%) create mode 100644 src/Correlate.Abstractions/OnError.cs delete mode 100644 src/Correlate.Abstractions/OnException.cs diff --git a/Migration.md b/Migration.md index 7f41d01..cde6bec 100644 --- a/Migration.md +++ b/Migration.md @@ -1,6 +1,8 @@ ### Migration from v5.x to 6.0.0 - `CorrelateOptions.RequestHeaders` no longer has a default value of `X-Correlation-ID`. However, if this property is set to `null` (or not configured explicitly at all), internally the behavior remains unchanged and `X-Correlation-ID` is assumed. See [#128](https://github.com/skwasjer/Correlate/issues/128). +- `OnException` is renamed to `OnError`. +- `ExceptionContext` is renamed to `ErrorContext`. ### Migration from v4.x to 5.0.0 diff --git a/src/Correlate.Abstractions/ExceptionContext.cs b/src/Correlate.Abstractions/ErrorContext.cs similarity index 70% rename from src/Correlate.Abstractions/ExceptionContext.cs rename to src/Correlate.Abstractions/ErrorContext.cs index fa7d5c1..3388120 100644 --- a/src/Correlate.Abstractions/ExceptionContext.cs +++ b/src/Correlate.Abstractions/ErrorContext.cs @@ -4,11 +4,11 @@ namespace Correlate; /// -/// Represents a context that provides access to the exception that occurred inside a correlated activity, with the ability to mark the exception as handled. +/// Represents a context that provides access to the exception that occurred inside a correlated activity, with the ability to mark the error as handled. /// -public class ExceptionContext +public class ErrorContext { - internal ExceptionContext(CorrelationContext correlationContext, Exception exception) + internal ErrorContext(CorrelationContext correlationContext, Exception exception) { CorrelationContext = correlationContext; Exception = exception; @@ -25,21 +25,21 @@ internal ExceptionContext(CorrelationContext correlationContext, Exception excep public Exception Exception { get; } /// - /// Gets or sets whether the exception is considered handled. + /// Gets or sets whether the error is considered handled. /// - public bool IsExceptionHandled { get; set; } + public bool IsErrorHandled { get; set; } } /// -/// Represents a context that provides access to the exception that occurred inside a correlated activity, with the ability to mark the exception as handled and provide a return value. +/// Represents a context that provides access to the exception that occurred inside a correlated activity, with the ability to mark the error as handled and provide a return value. /// -public class ExceptionContext : ExceptionContext +public class ErrorContext : ErrorContext { // ReSharper disable once RedundantDefaultMemberInitializer [DebuggerBrowsable(DebuggerBrowsableState.Never)] private T _result = default!; - internal ExceptionContext(CorrelationContext correlationContext, Exception exception) + internal ErrorContext(CorrelationContext correlationContext, Exception exception) : base(correlationContext, exception) { } @@ -53,7 +53,7 @@ public T Result get => _result; set { - IsExceptionHandled = true; + IsErrorHandled = true; _result = value!; } } diff --git a/src/Correlate.Abstractions/IAsyncCorrelationManager.cs b/src/Correlate.Abstractions/IAsyncCorrelationManager.cs index 1ba9697..dce1432 100644 --- a/src/Correlate.Abstractions/IAsyncCorrelationManager.cs +++ b/src/Correlate.Abstractions/IAsyncCorrelationManager.cs @@ -10,12 +10,12 @@ public interface IAsyncCorrelationManager /// /// The correlation id to use, or null to generate a new one. /// The task to execute. - /// A delegate to handle the exception inside the correlation scope, before it is disposed. Returns to consider the exception handled, or to throw. + /// A delegate to handle the error inside the correlation scope, before it is disposed. Returns to consider the error handled, or to throw. /// An awaitable that completes once the has executed and the correlation context has disposed. /// /// When logging and tracing are both disabled, no correlation context is created and the task simply executed as it normally would. /// - Task CorrelateAsync(string? correlationId, Func correlatedTask, OnException? onException); + public Task CorrelateAsync(string? correlationId, Func correlatedTask, OnError? onError); /// /// Executes the with its own . @@ -23,10 +23,10 @@ public interface IAsyncCorrelationManager /// The return type of the awaitable task. /// The correlation id to use, or null to generate a new one. /// The task to execute. - /// A delegate to handle the exception inside the correlation scope, before it is disposed. Returns to consider the exception handled, or to throw. + /// A delegate to handle the error inside the correlation scope, before it is disposed. Returns to consider the error handled, or to throw. /// An awaitable that completes with a result once the has executed and the correlation context has disposed. /// /// When logging and tracing are both disabled, no correlation context is created and the task simply executed as it normally would. /// - Task CorrelateAsync(string? correlationId, Func> correlatedTask, OnException? onException); + public Task CorrelateAsync(string? correlationId, Func> correlatedTask, OnError? onError); } diff --git a/src/Correlate.Abstractions/ICorrelationManager.cs b/src/Correlate.Abstractions/ICorrelationManager.cs index 65fa1a9..03d1dbf 100644 --- a/src/Correlate.Abstractions/ICorrelationManager.cs +++ b/src/Correlate.Abstractions/ICorrelationManager.cs @@ -10,11 +10,11 @@ public interface ICorrelationManager /// /// The correlation id to use, or null to generate a new one. /// The action to execute. - /// A delegate to handle the exception inside the correlation scope, before it is disposed. Returns to consider the exception handled, or to throw. + /// A delegate to handle the error inside the correlation scope, before it is disposed. Returns to consider the error handled, or to throw. /// /// When logging and tracing are both disabled, no correlation context is created and the action simply executed as it normally would. /// - void Correlate(string? correlationId, Action correlatedAction, OnException? onException); + public void Correlate(string? correlationId, Action correlatedAction, OnError? onError); /// /// Executes the with its own . @@ -22,10 +22,10 @@ public interface ICorrelationManager /// The return type. /// The correlation id to use, or null to generate a new one. /// The func to execute. - /// A delegate to handle the exception inside the correlation scope, before it is disposed. Returns to consider the exception handled, or to throw. + /// A delegate to handle the error inside the correlation scope, before it is disposed. Returns to consider the error handled, or to throw. /// Returns the result of the . /// /// When logging and tracing are both disabled, no correlation context is created and the action simply executed as it normally would. /// - T Correlate(string? correlationId, Func correlatedFunc, OnException? onException); + public T Correlate(string? correlationId, Func correlatedFunc, OnError? onError); } diff --git a/src/Correlate.Abstractions/OnError.cs b/src/Correlate.Abstractions/OnError.cs new file mode 100644 index 0000000..f7ac8c2 --- /dev/null +++ b/src/Correlate.Abstractions/OnError.cs @@ -0,0 +1,15 @@ +namespace Correlate; + +/// +/// A delegate for handling errors inside correlation scope. +/// +/// The error context. +#pragma warning disable CA1711 +public delegate void OnError(ErrorContext errorContext); + +/// +/// A delegate for handling errors inside correlation scope. +/// +/// The error context. +public delegate void OnError(ErrorContext errorContext); +#pragma warning restore CA1711 diff --git a/src/Correlate.Abstractions/OnException.cs b/src/Correlate.Abstractions/OnException.cs deleted file mode 100644 index 6887429..0000000 --- a/src/Correlate.Abstractions/OnException.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Correlate; - -/// -/// A delegate for handling exception inside correlation scope. -/// -/// The exception context. -public delegate void OnException(ExceptionContext exceptionContext); - -/// -/// A delegate for handling exception inside correlation scope. -/// -/// The exception context. -public delegate void OnException(ExceptionContext exceptionContext); diff --git a/src/Correlate.Core/CorrelationManager.cs b/src/Correlate.Core/CorrelationManager.cs index 6bffe69..ff1921a 100644 --- a/src/Correlate.Core/CorrelationManager.cs +++ b/src/Correlate.Core/CorrelationManager.cs @@ -14,7 +14,7 @@ public class CorrelationManager : IAsyncCorrelationManager, ICorrelationManager, private readonly ICorrelationIdFactory _correlationIdFactory; private readonly DiagnosticListener? _diagnosticListener; private readonly ILogger _logger; - private readonly CorrelationManagerOptions _options = new CorrelationManagerOptions(); + private readonly CorrelationManagerOptions _options = new(); /// /// Initializes a new instance of the class. @@ -93,12 +93,12 @@ public IActivity CreateActivity() /// /// The correlation id to use, or null to generate a new one. /// The task to execute. - /// A delegate to handle the exception inside the correlation scope, before it is disposed. Returns to consider the exception handled, or to throw. + /// A delegate to handle the error inside the correlation scope, before it is disposed. Returns to consider the error handled, or to throw. /// An awaitable that completes once the has executed and the correlation context has disposed. /// /// When logging and tracing are both disabled, no correlation context is created and the task simply executed as it normally would. /// - public Task CorrelateAsync(string? correlationId, Func correlatedTask, OnException? onException) + public Task CorrelateAsync(string? correlationId, Func correlatedTask, OnError? onError) { if (correlatedTask is null) { @@ -112,7 +112,7 @@ public Task CorrelateAsync(string? correlationId, Func correlatedTask, OnE await correlatedTask().ConfigureAwait(false); return Void.Null; }, - onException + onError ); } @@ -122,12 +122,12 @@ public Task CorrelateAsync(string? correlationId, Func correlatedTask, OnE /// The return type of the awaitable task. /// The correlation id to use, or null to generate a new one. /// The task to execute. - /// A delegate to handle the exception inside the correlation scope, before it is disposed. Returns to consider the exception handled, or to throw. + /// A delegate to handle the error inside the correlation scope, before it is disposed. Returns to consider the error handled, or to throw. /// An awaitable that completes with a result once the has executed and the correlation context has disposed. /// /// When logging and tracing are both disabled, no correlation context is created and the task simply executed as it normally would. /// - public Task CorrelateAsync(string? correlationId, Func> correlatedTask, OnException? onException) + public Task CorrelateAsync(string? correlationId, Func> correlatedTask, OnError? onError) { if (correlatedTask is null) { @@ -137,7 +137,9 @@ public Task CorrelateAsync(string? correlationId, Func> correlated return ExecuteAsync( correlationId, correlatedTask, - onException is null ? null : context => onException((ExceptionContext)context) + onError is null + ? null + : context => onError((ErrorContext)context) ); } @@ -146,11 +148,11 @@ public Task CorrelateAsync(string? correlationId, Func> correlated /// /// The correlation id to use, or null to generate a new one. /// The action to execute. - /// A delegate to handle the exception inside the correlation scope, before it is disposed. Returns to consider the exception handled, or to throw. + /// A delegate to handle the error inside the correlation scope, before it is disposed. Returns to consider the error handled, or to throw. /// /// When logging and tracing are both disabled, no correlation context is created and the action simply executed as it normally would. /// - public void Correlate(string? correlationId, Action correlatedAction, OnException? onException) + public void Correlate(string? correlationId, Action correlatedAction, OnError? onError) { if (correlatedAction is null) { @@ -163,7 +165,7 @@ public void Correlate(string? correlationId, Action correlatedAction, OnExceptio correlatedAction(); return Void.Null; }, - onException); + onError); } /// @@ -172,12 +174,12 @@ public void Correlate(string? correlationId, Action correlatedAction, OnExceptio /// The return type. /// The correlation id to use, or null to generate a new one. /// The func to execute. - /// A delegate to handle the exception inside the correlation scope, before it is disposed. Returns to consider the exception handled, or to throw. + /// A delegate to handle the error inside the correlation scope, before it is disposed. Returns to consider the error handled, or to throw. /// Returns the result of the . /// /// When logging and tracing are both disabled, no correlation context is created and the action simply executed as it normally would. /// - public T Correlate(string? correlationId, Func correlatedFunc, OnException? onException) + public T Correlate(string? correlationId, Func correlatedFunc, OnError? onError) { if (correlatedFunc is null) { @@ -187,11 +189,13 @@ public T Correlate(string? correlationId, Func correlatedFunc, OnException return Execute( correlationId, correlatedFunc, - onException is null ? null : context => onException((ExceptionContext)context) + onError is null + ? null + : context => onError((ErrorContext)context) ); } - private async Task ExecuteAsync(string? correlationId, Func> correlatedTask, OnException? onException) + private async Task ExecuteAsync(string? correlationId, Func> correlatedTask, OnError? onError) { IActivity activity = CreateActivity(); CorrelationContext correlationContext = StartActivity(correlationId, activity); @@ -200,7 +204,7 @@ private async Task ExecuteAsync(string? correlationId, Func> corre { return await correlatedTask().ConfigureAwait(false); } - catch (Exception ex) when (HandlesException(onException, correlationContext, ex, out T exceptionResult)) + catch (Exception ex) when (HandlesException(onError, correlationContext, ex, out T exceptionResult)) { return exceptionResult; } @@ -210,7 +214,7 @@ private async Task ExecuteAsync(string? correlationId, Func> corre } } - private T Execute(string? correlationId, Func correlatedFunc, OnException? onException) + private T Execute(string? correlationId, Func correlatedFunc, OnError? onError) { IActivity activity = CreateActivity(); CorrelationContext correlationContext = StartActivity(correlationId, activity); @@ -219,7 +223,7 @@ private T Execute(string? correlationId, Func correlatedFunc, OnException? { return correlatedFunc(); } - catch (Exception ex) when (HandlesException(onException, correlationContext, ex, out T exceptionResult)) + catch (Exception ex) when (HandlesException(onError, correlationContext, ex, out T exceptionResult)) { return exceptionResult; } @@ -229,7 +233,7 @@ private T Execute(string? correlationId, Func correlatedFunc, OnException? } } - private static bool HandlesException(OnException? onException, CorrelationContext correlationContext, Exception ex, out T result) + private static bool HandlesException(OnError? onError, CorrelationContext correlationContext, Exception ex, out T result) { if (!ex.Data.Contains(CorrelateConstants.CorrelationIdKey)) { @@ -237,20 +241,20 @@ private static bool HandlesException(OnException? onException, CorrelationCon ex.Data.Add(CorrelateConstants.CorrelationIdKey, correlationContext.CorrelationId); } - if (onException is not null) + if (onError is not null) { bool hasResultValue = typeof(T) != typeof(Void); // Allow caller to handle exception inline before losing context scope. - ExceptionContext exceptionContext = hasResultValue - ? new ExceptionContext(correlationContext, ex) - : new ExceptionContext(correlationContext, ex); + ErrorContext errorContext = hasResultValue + ? new ErrorContext(correlationContext, ex) + : new ErrorContext(correlationContext, ex); - onException(exceptionContext); - if (exceptionContext.IsExceptionHandled) + onError(errorContext); + if (errorContext.IsErrorHandled) { result = hasResultValue - ? ((ExceptionContext)exceptionContext).Result + ? ((ErrorContext)errorContext).Result : default!; return true; } diff --git a/src/Correlate.Core/Extensions/AsyncCorrelationManagerExtensions.cs b/src/Correlate.Core/Extensions/AsyncCorrelationManagerExtensions.cs index cdf4d9e..7f5af25 100644 --- a/src/Correlate.Core/Extensions/AsyncCorrelationManagerExtensions.cs +++ b/src/Correlate.Core/Extensions/AsyncCorrelationManagerExtensions.cs @@ -1,6 +1,5 @@ - +// ReSharper disable once CheckNamespace - Justification: common extension methods for the manager should be readily accessible. -// ReSharper disable once CheckNamespace - Justification: common extension methods for the manager should be readily accessible. namespace Correlate; /// @@ -27,19 +26,19 @@ public static Task CorrelateAsync(this IAsyncCorrelationManager asyncCorrelation /// /// The async correlation manager. /// The task to execute. - /// A delegate to handle the exception inside the correlation scope, before it is disposed. Returns to consider the exception handled, or to throw. + /// A delegate to handle the error inside the correlation scope, before it is disposed. Returns to consider the error handled, or to throw. /// An awaitable that completes once the has executed and the correlation context has disposed. /// /// When logging and tracing are both disabled, no correlation context is created and the task simply executed as it normally would. /// - public static Task CorrelateAsync(this IAsyncCorrelationManager asyncCorrelationManager, Func correlatedTask, OnException? onException) + public static Task CorrelateAsync(this IAsyncCorrelationManager asyncCorrelationManager, Func correlatedTask, OnError? onError) { if (asyncCorrelationManager is null) { throw new ArgumentNullException(nameof(asyncCorrelationManager)); } - return asyncCorrelationManager.CorrelateAsync(null, correlatedTask, onException); + return asyncCorrelationManager.CorrelateAsync(null, correlatedTask, onError); } /// @@ -83,19 +82,19 @@ public static Task CorrelateAsync(this IAsyncCorrelationManager asyncCorre /// The return type of the awaitable task. /// The async correlation manager. /// The task to execute. - /// A delegate to handle the exception inside the correlation scope, before it is disposed. Returns to consider the exception handled, or to throw. + /// A delegate to handle the error inside the correlation scope, before it is disposed. Returns to consider the error handled, or to throw. /// An awaitable that completes with a result once the has executed and the correlation context has disposed. /// /// When logging and tracing are both disabled, no correlation context is created and the task simply executed as it normally would. /// - public static Task CorrelateAsync(this IAsyncCorrelationManager asyncCorrelationManager, Func> correlatedTask, OnException? onException) + public static Task CorrelateAsync(this IAsyncCorrelationManager asyncCorrelationManager, Func> correlatedTask, OnError? onError) { if (asyncCorrelationManager is null) { throw new ArgumentNullException(nameof(asyncCorrelationManager)); } - return asyncCorrelationManager.CorrelateAsync(null, correlatedTask, onException); + return asyncCorrelationManager.CorrelateAsync(null, correlatedTask, onError); } /// diff --git a/src/Correlate.Core/Extensions/CorrelationManagerExtensions.cs b/src/Correlate.Core/Extensions/CorrelationManagerExtensions.cs index c0aa93e..2dffb0b 100644 --- a/src/Correlate.Core/Extensions/CorrelationManagerExtensions.cs +++ b/src/Correlate.Core/Extensions/CorrelationManagerExtensions.cs @@ -1,6 +1,5 @@ - +// ReSharper disable once CheckNamespace - Justification: common extension methods for the manager should be readily accessible. -// ReSharper disable once CheckNamespace - Justification: common extension methods for the manager should be readily accessible. namespace Correlate; /// @@ -26,18 +25,18 @@ public static void Correlate(this ICorrelationManager correlationManager, Action /// /// The correlation manager. /// The action to execute. - /// A delegate to handle the exception inside the correlation scope, before it is disposed. Returns to consider the exception handled, or to throw. + /// A delegate to handle the error inside the correlation scope, before it is disposed. Returns to consider the error handled, or to throw. /// /// When logging and tracing are both disabled, no correlation context is created and the action simply executed as it normally would. /// - public static void Correlate(this ICorrelationManager correlationManager, Action correlatedAction, OnException? onException) + public static void Correlate(this ICorrelationManager correlationManager, Action correlatedAction, OnError? onError) { if (correlationManager is null) { throw new ArgumentNullException(nameof(correlationManager)); } - correlationManager.Correlate(null, correlatedAction, onException); + correlationManager.Correlate(null, correlatedAction, onError); } /// @@ -80,19 +79,19 @@ public static T Correlate(this ICorrelationManager correlationManager, FuncThe return type. /// The correlation manager. /// The func to execute. - /// A delegate to handle the exception inside the correlation scope, before it is disposed. Returns to consider the exception handled, or to throw. + /// A delegate to handle the error inside the correlation scope, before it is disposed. Returns to consider the error handled, or to throw. /// Returns the result of the . /// /// When logging and tracing are both disabled, no correlation context is created and the action simply executed as it normally would. /// - public static T Correlate(this ICorrelationManager correlationManager, Func correlatedFunc, OnException? onException) + public static T Correlate(this ICorrelationManager correlationManager, Func correlatedFunc, OnError? onError) { if (correlationManager is null) { throw new ArgumentNullException(nameof(correlationManager)); } - return correlationManager.Correlate(null, correlatedFunc, onException); + return correlationManager.Correlate(null, correlatedFunc, onError); } /// diff --git a/test/Correlate.Core.Tests/CorrelationManagerTests.cs b/test/Correlate.Core.Tests/CorrelationManagerTests.cs index 48e3403..c4ae8ce 100644 --- a/test/Correlate.Core.Tests/CorrelationManagerTests.cs +++ b/test/Correlate.Core.Tests/CorrelationManagerTests.cs @@ -202,7 +202,7 @@ public async Task When_handling_exception_with_delegate_should_not_throw() { ctx.CorrelationContext.CorrelationId.Should().Be(GeneratedCorrelationId); ctx.Exception.Should().Be(exception); - ctx.IsExceptionHandled = handlesException; + ctx.IsErrorHandled = handlesException; }); // Assert @@ -218,7 +218,7 @@ public async Task When_not_handling_exception_with_delegate_should_still_throw() // Act Func act = () => _sut.CorrelateAsync( () => throw exception, - ctx => ctx.IsExceptionHandled = handlesException + ctx => ctx.IsErrorHandled = handlesException ); // Assert @@ -527,7 +527,7 @@ public void When_handling_exception_with_delegate_should_not_throw() { ctx.CorrelationContext.CorrelationId.Should().Be(GeneratedCorrelationId); ctx.Exception.Should().Be(exception); - ctx.IsExceptionHandled = handlesException; + ctx.IsErrorHandled = handlesException; }); // Assert @@ -543,7 +543,7 @@ public void When_not_handling_exception_with_delegate_should_still_throw() // Act Action act = () => _sut.Correlate( () => throw exception, - ctx => ctx.IsExceptionHandled = handlesException + ctx => ctx.IsErrorHandled = handlesException ); // Assert @@ -728,19 +728,19 @@ static int ReturningCorrelatedFunc() return new[] { // Instance members - DelegateTestCase.Create(instance.CorrelateAsync, (string?)null, (Func)CorrelatedTask, (OnException?)null), - DelegateTestCase.Create(instance.CorrelateAsync, (string?)null, (Func>)ReturningCorrelatedTask, (OnException?)null), - DelegateTestCase.Create(instance.Correlate, (string?)null, (Action)CorrelatedAction, (OnException?)null), - DelegateTestCase.Create(instance.Correlate, (string?)null, (Func)ReturningCorrelatedFunc, (OnException?)null), + DelegateTestCase.Create(instance.CorrelateAsync, (string?)null, (Func)CorrelatedTask, (OnError?)null), + DelegateTestCase.Create(instance.CorrelateAsync, (string?)null, (Func>)ReturningCorrelatedTask, (OnError?)null), + DelegateTestCase.Create(instance.Correlate, (string?)null, (Action)CorrelatedAction, (OnError?)null), + DelegateTestCase.Create(instance.Correlate, (string?)null, (Func)ReturningCorrelatedFunc, (OnError?)null), // Extensions DelegateTestCase.Create(AsyncCorrelationManagerExtensions.CorrelateAsync, instance, (Func)CorrelatedTask), DelegateTestCase.Create(AsyncCorrelationManagerExtensions.CorrelateAsync, instance, (Func>)ReturningCorrelatedTask), DelegateTestCase.Create(CorrelationManagerExtensions.Correlate, instance, (Action)CorrelatedAction), DelegateTestCase.Create(CorrelationManagerExtensions.Correlate, instance, (Func)ReturningCorrelatedFunc), - DelegateTestCase.Create(AsyncCorrelationManagerExtensions.CorrelateAsync, instance, (Func)CorrelatedTask, (OnException?)null), - DelegateTestCase.Create(AsyncCorrelationManagerExtensions.CorrelateAsync, instance, (Func>)ReturningCorrelatedTask, (OnException?)null), - DelegateTestCase.Create(CorrelationManagerExtensions.Correlate, instance, (Action)CorrelatedAction, (OnException?)null), - DelegateTestCase.Create(CorrelationManagerExtensions.Correlate, instance, (Func)ReturningCorrelatedFunc, (OnException?)null) + DelegateTestCase.Create(AsyncCorrelationManagerExtensions.CorrelateAsync, instance, (Func)CorrelatedTask, (OnError?)null), + DelegateTestCase.Create(AsyncCorrelationManagerExtensions.CorrelateAsync, instance, (Func>)ReturningCorrelatedTask, (OnError?)null), + DelegateTestCase.Create(CorrelationManagerExtensions.Correlate, instance, (Action)CorrelatedAction, (OnError?)null), + DelegateTestCase.Create(CorrelationManagerExtensions.Correlate, instance, (Func)ReturningCorrelatedFunc, (OnError?)null) } .SelectMany(tc => tc.GetNullArgumentTestCases()); }