diff --git a/web/backend/API/API.Core/API.Core.csproj b/web/backend/API/API.Core/API.Core.csproj
index f81e1a84..19544d6c 100644
--- a/web/backend/API/API.Core/API.Core.csproj
+++ b/web/backend/API/API.Core/API.Core.csproj
@@ -15,7 +15,7 @@
-
+
diff --git a/web/backend/Database/Database.Seed/Database.Seed.csproj b/web/backend/Database/Database.Seed/Database.Seed.csproj
index 3e306666..a50a0640 100644
--- a/web/backend/Database/Database.Seed/Database.Seed.csproj
+++ b/web/backend/Database/Database.Seed/Database.Seed.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/web/backend/Shared/Shared.Application.Tests/Behaviors/UnhandledExceptionLoggingBehaviorTests.cs b/web/backend/Shared/Shared.Application.Tests/Behaviors/UnhandledExceptionLoggingBehaviorTests.cs
index 5514233a..1a056d8d 100644
--- a/web/backend/Shared/Shared.Application.Tests/Behaviors/UnhandledExceptionLoggingBehaviorTests.cs
+++ b/web/backend/Shared/Shared.Application.Tests/Behaviors/UnhandledExceptionLoggingBehaviorTests.cs
@@ -26,7 +26,7 @@ public class UnhandledExceptionLoggingBehaviorTests
UnhandledExceptionLoggingBehavior behavior = CreateBehavior();
TestRequest request = new("aaron", "pa$$word123");
InvalidOperationException thrown = new("Something went wrong.");
- RequestHandlerDelegate next = () => throw thrown;
+ Task next(CancellationToken _ = default) => throw thrown;
Func act = async () => await behavior.Handle(request, next, CancellationToken.None);
@@ -42,7 +42,7 @@ public class UnhandledExceptionLoggingBehaviorTests
UnhandledExceptionLoggingBehavior behavior = CreateBehavior();
TestRequest request = new("aaron", "pa$$word123");
ValidationException thrown = new([new ValidationFailure("Username", "is required")]);
- RequestHandlerDelegate next = () => throw thrown;
+ Task next(CancellationToken _ = default) => throw thrown;
Func act = async () => await behavior.Handle(request, next, CancellationToken.None);
@@ -56,7 +56,7 @@ public class UnhandledExceptionLoggingBehaviorTests
UnhandledExceptionLoggingBehavior behavior = CreateBehavior();
TestRequest request = new("aaron", "pa$$word123");
TestResponse response = new("ok");
- RequestHandlerDelegate next = () => Task.FromResult(response);
+ Task next(CancellationToken _ = default) => Task.FromResult(response);
TestResponse result = await behavior.Handle(request, next, CancellationToken.None);
@@ -69,7 +69,7 @@ public class UnhandledExceptionLoggingBehaviorTests
{
UnhandledExceptionLoggingBehavior behavior = CreateBehavior();
TestRequest request = new("aaron", "pa$$word123");
- RequestHandlerDelegate next = () =>
+ Task next(CancellationToken _ = default) =>
throw new InvalidOperationException("Something went wrong.");
Func act = async () => await behavior.Handle(request, next, CancellationToken.None);
diff --git a/web/backend/Shared/Shared.Application.Tests/Behaviors/ValidationBehaviorTests.cs b/web/backend/Shared/Shared.Application.Tests/Behaviors/ValidationBehaviorTests.cs
index 71919190..25acf7ef 100644
--- a/web/backend/Shared/Shared.Application.Tests/Behaviors/ValidationBehaviorTests.cs
+++ b/web/backend/Shared/Shared.Application.Tests/Behaviors/ValidationBehaviorTests.cs
@@ -31,17 +31,13 @@ public class ValidationBehaviorTests
TestRequest request = new("aaron", "pa$$word123");
TestResponse response = new("ok");
bool nextInvoked = false;
- RequestHandlerDelegate next = () =>
+ Task next(CancellationToken _ = default)
{
nextInvoked = true;
return Task.FromResult(response);
- };
+ }
- TestResponse result = await behavior.Handle(
- request,
- next,
- CancellationToken.None
- );
+ TestResponse result = await behavior.Handle(request, next, CancellationToken.None);
nextInvoked.Should().BeTrue();
result.Should().BeSameAs(response);
@@ -65,11 +61,11 @@ public class ValidationBehaviorTests
);
TestRequest request = new("", "pa$$word123");
bool nextInvoked = false;
- RequestHandlerDelegate next = () =>
+ Task next(CancellationToken _ = default)
{
nextInvoked = true;
return Task.FromResult(new TestResponse("ok"));
- };
+ }
Func act = async () => await behavior.Handle(request, next, CancellationToken.None);
@@ -107,7 +103,7 @@ public class ValidationBehaviorTests
secondValidatorMock.Object
);
TestRequest request = new("aaron", "pa$$word123");
- RequestHandlerDelegate next = () =>
+ static Task next(CancellationToken _ = default) =>
Task.FromResult(new TestResponse("ok"));
await behavior.Handle(request, next, CancellationToken.None);
@@ -158,7 +154,7 @@ public class ValidationBehaviorTests
secondValidatorMock.Object
);
TestRequest request = new("", "pa$$word123");
- RequestHandlerDelegate next = () =>
+ Task next(CancellationToken _ = default) =>
Task.FromResult(new TestResponse("ok"));
Func act = async () => await behavior.Handle(request, next, CancellationToken.None);
@@ -171,17 +167,12 @@ public class ValidationBehaviorTests
[Fact]
public async Task Handle_WhenNoValidatorsAreRegistered_InvokesNext()
{
- ValidationBehavior behavior =
- CreateBehavior();
+ ValidationBehavior behavior = CreateBehavior();
TestRequest request = new("aaron", "pa$$word123");
TestResponse response = new("ok");
- RequestHandlerDelegate next = () => Task.FromResult(response);
+ Task next(CancellationToken _ = default) => Task.FromResult(response);
- TestResponse result = await behavior.Handle(
- request,
- next,
- CancellationToken.None
- );
+ TestResponse result = await behavior.Handle(request, next, CancellationToken.None);
result.Should().BeSameAs(response);
}
diff --git a/web/backend/Shared/Shared.Application/Behaviors/UnhandledExceptionLoggingBehavior.cs b/web/backend/Shared/Shared.Application/Behaviors/UnhandledExceptionLoggingBehavior.cs
index 0137b683..4eec359e 100644
--- a/web/backend/Shared/Shared.Application/Behaviors/UnhandledExceptionLoggingBehavior.cs
+++ b/web/backend/Shared/Shared.Application/Behaviors/UnhandledExceptionLoggingBehavior.cs
@@ -67,7 +67,7 @@ public partial class UnhandledExceptionLoggingBehavior
{
try
{
- return await next();
+ return await next(cancellationToken);
}
catch (ValidationException)
{
@@ -78,7 +78,7 @@ public partial class UnhandledExceptionLoggingBehavior
{
if (_logger.IsEnabled(LogLevel.Error))
LogUnhandledException(ex, typeof(TRequest).Name, Serialize(request));
-
+
throw;
}
}
diff --git a/web/backend/Shared/Shared.Application/Behaviors/ValidationBehavior.cs b/web/backend/Shared/Shared.Application/Behaviors/ValidationBehavior.cs
index 6c18690e..6f72a573 100644
--- a/web/backend/Shared/Shared.Application/Behaviors/ValidationBehavior.cs
+++ b/web/backend/Shared/Shared.Application/Behaviors/ValidationBehavior.cs
@@ -21,7 +21,7 @@ public class ValidationBehavior(IEnumerable context = new(request);
@@ -35,6 +35,6 @@ public class ValidationBehavior(IEnumerable 0)
throw new ValidationException(failures);
- return await next();
+ return await next(cancellationToken);
}
}
diff --git a/web/backend/Shared/Shared.Application/Shared.Application.csproj b/web/backend/Shared/Shared.Application/Shared.Application.csproj
index 305d1df0..f50a7b1e 100644
--- a/web/backend/Shared/Shared.Application/Shared.Application.csproj
+++ b/web/backend/Shared/Shared.Application/Shared.Application.csproj
@@ -7,7 +7,7 @@
-
+