diff --git a/.github/workflows/template-build-test-project.yml b/.github/workflows/template-build-test-project.yml
index 256b3c5..be825c7 100644
--- a/.github/workflows/template-build-test-project.yml
+++ b/.github/workflows/template-build-test-project.yml
@@ -30,13 +30,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- dotnet-target-framework: ["net8.0", "net9.0"]
+ dotnet-target-framework: ["net10.0"]
include:
- - dotnet-install-framework: 8.0.x
- dotnet-target-framework: net8.0
+ - dotnet-install-framework: 10.0.x
+ dotnet-target-framework: net10.0
- - dotnet-install-framework: 9.0.x
- dotnet-target-framework: net9.0
env:
source-directory: ${{ inputs.source-directory }}
source-project: ${{ inputs.source-project }}
diff --git a/.github/workflows/template-build-test-solution.yml b/.github/workflows/template-build-test-solution.yml
index 5282f67..99936a2 100644
--- a/.github/workflows/template-build-test-solution.yml
+++ b/.github/workflows/template-build-test-solution.yml
@@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
env:
- dotnet-install-framework: 9.0.x
+ dotnet-install-framework: 10.0.x
defaults:
run:
diff --git a/Directory.Packages.props b/Directory.Packages.props
index ca56277..47f1f55 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -5,30 +5,22 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
diff --git a/samples/Directory.Packages.props b/samples/Directory.Packages.props
index 66dae7b..cd55a4f 100644
--- a/samples/Directory.Packages.props
+++ b/samples/Directory.Packages.props
@@ -5,21 +5,20 @@
-
+
-
-
-
+
+
+
-
-
-
+
+
diff --git a/samples/MiddlewareSample/MiddlewareSample.Api.Test/MiddlewareSample.Api.Test.csproj b/samples/MiddlewareSample/MiddlewareSample.Api.Test/MiddlewareSample.Api.Test.csproj
index 1f7066e..0d6e237 100644
--- a/samples/MiddlewareSample/MiddlewareSample.Api.Test/MiddlewareSample.Api.Test.csproj
+++ b/samples/MiddlewareSample/MiddlewareSample.Api.Test/MiddlewareSample.Api.Test.csproj
@@ -1,7 +1,7 @@
- net9.0
+ net10.0
false
true
@@ -10,7 +10,7 @@
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
diff --git a/samples/MiddlewareSample/MiddlewareSample.Api.Test/MiddlewareSampleTests.cs b/samples/MiddlewareSample/MiddlewareSample.Api.Test/MiddlewareSampleTests.cs
index 96e8c83..ca8285d 100644
--- a/samples/MiddlewareSample/MiddlewareSample.Api.Test/MiddlewareSampleTests.cs
+++ b/samples/MiddlewareSample/MiddlewareSample.Api.Test/MiddlewareSampleTests.cs
@@ -12,7 +12,6 @@
using System.Text.Json;
using System.Web;
using BlazorFocused.Exceptions.Middleware;
-using Xunit.Abstractions;
namespace MiddlewareSample.Api.Test;
@@ -38,7 +37,7 @@ public async Task ShouldReturnProperStatusCodes()
string url = $"/ThrowCustomClientException?statusCode={(int)expectedStatusCode}";
- HttpResponseMessage httpResponseMessage = await httpClient.GetAsync(url);
+ HttpResponseMessage httpResponseMessage = await httpClient.GetAsync(url, TestContext.Current.CancellationToken);
testOutputHelper.WriteLine("Expected Status Code: {0}", httpResponseMessage.StatusCode);
@@ -52,7 +51,7 @@ public async Task ShouldReturnAmbiguousForRandomException()
{
string url = "/ThrowRandomException";
- HttpResponseMessage httpResponseMessage = await httpClient.GetAsync(url);
+ HttpResponseMessage httpResponseMessage = await httpClient.GetAsync(url, TestContext.Current.CancellationToken);
ProblemDetails problemDetails = await GetProblemDetailsAsync(httpResponseMessage);
@@ -73,7 +72,7 @@ public async Task ShouldReturnRuntimeExceptionStatusCodeException()
string url = $"/ThrowCustomClientException?statusCode={(int)expectedStatusCode}&message={expectedMessage}";
- HttpResponseMessage httpResponseMessage = await httpClient.GetAsync(url);
+ HttpResponseMessage httpResponseMessage = await httpClient.GetAsync(url, TestContext.Current.CancellationToken);
ProblemDetails problemDetails = await GetProblemDetailsAsync(httpResponseMessage);
@@ -95,7 +94,7 @@ public async Task ShouldReturnClientSpecificExceptionMessage()
string url = $"/ThrowCustomClientException?statusCode={(int)expectedStatusCode}&message={internalExceptionMessage}&clientMessage={expectedClientMessage}";
- HttpResponseMessage httpResponseMessage = await httpClient.GetAsync(url);
+ HttpResponseMessage httpResponseMessage = await httpClient.GetAsync(url, TestContext.Current.CancellationToken);
ProblemDetails problemDetails = await GetProblemDetailsAsync(httpResponseMessage);
diff --git a/samples/MiddlewareSample/MiddlewareSample.Api/MiddlewareSample.Api.csproj b/samples/MiddlewareSample/MiddlewareSample.Api/MiddlewareSample.Api.csproj
index c5a4fa9..3cd9033 100644
--- a/samples/MiddlewareSample/MiddlewareSample.Api/MiddlewareSample.Api.csproj
+++ b/samples/MiddlewareSample/MiddlewareSample.Api/MiddlewareSample.Api.csproj
@@ -1,7 +1,7 @@
- net9.0
+ net10.0
false
diff --git a/samples/MiddlewareSample/MiddlewareSample.Api/Program.cs b/samples/MiddlewareSample/MiddlewareSample.Api/Program.cs
index cf6a85b..c3f3970 100644
--- a/samples/MiddlewareSample/MiddlewareSample.Api/Program.cs
+++ b/samples/MiddlewareSample/MiddlewareSample.Api/Program.cs
@@ -43,8 +43,7 @@
app.MapGet("/ThrowRandomException", () =>
{
throw new RandomException();
-})
-.WithOpenApi();
+});
app.MapGet("/ThrowCustomClientException", (
[FromQuery] HttpStatusCode? statusCode,
@@ -65,8 +64,7 @@
};
throw exception;
-})
-.WithOpenApi();
+});
app.Run();
diff --git a/src/Middleware/src/BlazorFocused.Exceptions.Middleware.csproj b/src/Middleware/src/BlazorFocused.Exceptions.Middleware.csproj
index 4a2e85d..d0a8ef6 100644
--- a/src/Middleware/src/BlazorFocused.Exceptions.Middleware.csproj
+++ b/src/Middleware/src/BlazorFocused.Exceptions.Middleware.csproj
@@ -1,7 +1,7 @@
- net8.0;net9.0
+ net10.0
diff --git a/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.Correlation.cs b/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.Correlation.cs
index 42d40ea..8e45aa9 100644
--- a/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.Correlation.cs
+++ b/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.Correlation.cs
@@ -3,15 +3,14 @@
// Licensed under the MIT License
// -------------------------------------------------------
+using BlazorFocused.Exceptions.Middleware.ApplicationBuilder;
+using BlazorFocused.Exceptions.Middleware.ExceptionBuilder;
using Bogus;
-using FluentAssertions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using Moq;
-using BlazorFocused.Exceptions.Middleware.ApplicationBuilder;
-using BlazorFocused.Exceptions.Middleware.ExceptionBuilder;
namespace BlazorFocused.Exceptions.Middleware.Test.ApplicationBuilder;
@@ -37,7 +36,7 @@ public async Task Invoke_ShouldReturnConfiguredCorrelationKeyDuringError()
requestDelegateMock.Setup(request =>
request.Invoke(httpContext))
- .ThrowsAsync(thrownException);
+ .ThrowsAsync(thrownException);
Exception actualException =
await Record.ExceptionAsync(() =>
@@ -50,7 +49,7 @@ await Record.ExceptionAsync(() =>
ProblemDetails actualErrorResponse = await GetErrorResponseFromBody(memoryStream);
// Should be null since error is caught
- actualException.Should().BeNull();
+ Assert.Null(actualException);
// Check Key and default Guid Value
Assert.True(httpContext.Response.Headers.ContainsKey(expectedCorrelationHeader));
@@ -89,7 +88,7 @@ await Record.ExceptionAsync(() =>
NullLogger.Instance));
// Should be null since error is caught
- actualException.Should().BeNull();
+ Assert.Null(actualException);
// Check Key and default Guid Value
Assert.True(httpContext.Response.Headers.ContainsKey(expectedCorrelationHeader));
@@ -110,7 +109,7 @@ public async Task Invoke_ShouldReturnConfiguredCorrelationValueDuringError()
var exceptionsMiddlewareOptions = new ExceptionsMiddlewareOptions
{
- ConfigureCorrelationValue = (context) => context.TraceIdentifier
+ ConfigureCorrelationValue = context => context.TraceIdentifier
};
// IOptionsMonitor should not be called
@@ -119,7 +118,7 @@ public async Task Invoke_ShouldReturnConfiguredCorrelationValueDuringError()
requestDelegateMock.Setup(request =>
request.Invoke(httpContext))
- .ThrowsAsync(thrownException);
+ .ThrowsAsync(thrownException);
Exception actualException =
await Record.ExceptionAsync(() =>
@@ -132,10 +131,11 @@ await Record.ExceptionAsync(() =>
ProblemDetails actualErrorResponse = await GetErrorResponseFromBody(memoryStream);
// Should be null since error is caught
- actualException.Should().BeNull();
+ Assert.Null(actualException);
// Check Correlation Value
- Assert.Equal(expectedCorrelationValue, httpContext.Response.Headers[exceptionsMiddlewareOptions.CorrelationKey]);
+ Assert.Equal(expectedCorrelationValue,
+ httpContext.Response.Headers[exceptionsMiddlewareOptions.CorrelationKey]);
Assert.Equal(exceptionsMiddlewareOptions.DefaultErrorMessage, actualErrorResponse.Detail);
Assert.Equal(expectedInstance, actualErrorResponse.Instance);
@@ -156,7 +156,7 @@ public async Task Invoke_ShouldReturnConfiguredCorrelationValueWithoutError()
var exceptionsMiddlewareOptions = new ExceptionsMiddlewareOptions
{
- ConfigureCorrelationValue = (context) => context.TraceIdentifier
+ ConfigureCorrelationValue = context => context.TraceIdentifier
};
// IOptionsMonitor should not be called
@@ -172,10 +172,11 @@ await Record.ExceptionAsync(() =>
NullLogger.Instance));
// Should be null since error is caught
- actualException.Should().BeNull();
+ Assert.Null(actualException);
// Check Correlation Value
- Assert.Equal(expectedCorrelationValue, httpContext.Response.Headers[exceptionsMiddlewareOptions.CorrelationKey]);
+ Assert.Equal(expectedCorrelationValue,
+ httpContext.Response.Headers[exceptionsMiddlewareOptions.CorrelationKey]);
Assert.Equal(200, httpContext.Response.StatusCode);
}
@@ -194,7 +195,7 @@ public async Task Invoke_ShouldReturnConfiguredCorrelationKeyAndValueDuringError
var exceptionsMiddlewareOptions = new ExceptionsMiddlewareOptions
{
CorrelationKey = expectedCorrelationHeader,
- ConfigureCorrelationValue = (context) => context.TraceIdentifier
+ ConfigureCorrelationValue = context => context.TraceIdentifier
};
// IOptionsMonitor should not be called
@@ -203,7 +204,7 @@ public async Task Invoke_ShouldReturnConfiguredCorrelationKeyAndValueDuringError
requestDelegateMock.Setup(request =>
request.Invoke(httpContext))
- .ThrowsAsync(thrownException);
+ .ThrowsAsync(thrownException);
Exception actualException =
await Record.ExceptionAsync(() =>
@@ -216,7 +217,7 @@ await Record.ExceptionAsync(() =>
ProblemDetails actualErrorResponse = await GetErrorResponseFromBody(memoryStream);
// Should be null since error is caught
- actualException.Should().BeNull();
+ Assert.Null(actualException);
// Check Correlation Value
Assert.Equal(expectedCorrelationValue, httpContext.Response.Headers[expectedCorrelationHeader]);
@@ -242,7 +243,7 @@ public async Task Invoke_ShouldReturnConfiguredCorrelationKeyAndValueWithoutErro
var exceptionsMiddlewareOptions = new ExceptionsMiddlewareOptions
{
CorrelationKey = expectedCorrelationHeader,
- ConfigureCorrelationValue = (context) => context.TraceIdentifier
+ ConfigureCorrelationValue = context => context.TraceIdentifier
};
// IOptionsMonitor should not be called
@@ -258,7 +259,7 @@ await Record.ExceptionAsync(() =>
NullLogger.Instance));
// Should be null since error is caught
- actualException.Should().BeNull();
+ Assert.Null(actualException);
// Check Correlation Value
Assert.Equal(expectedCorrelationValue, httpContext.Response.Headers[expectedCorrelationHeader]);
diff --git a/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.Exception.cs b/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.Exception.cs
index de5a96c..7b96e84 100644
--- a/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.Exception.cs
+++ b/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.Exception.cs
@@ -3,8 +3,10 @@
// Licensed under the MIT License
// -------------------------------------------------------
+using BlazorFocused.Exceptions.Middleware.ApplicationBuilder;
+using BlazorFocused.Exceptions.Middleware.ExceptionBuilder;
+using BlazorFocused.Testing.Logging;
using Bogus;
-using FluentAssertions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
@@ -12,9 +14,6 @@
using Microsoft.Extensions.Options;
using Moq;
using System.Net;
-using BlazorFocused.Exceptions.Middleware.ApplicationBuilder;
-using BlazorFocused.Exceptions.Middleware.ExceptionBuilder;
-using BlazorFocused.Testing.Logging;
namespace BlazorFocused.Exceptions.Middleware.Test.ApplicationBuilder;
@@ -36,7 +35,7 @@ public async Task Invoke_ShouldReturnAbstractExceptionDetails()
requestDelegateMock.Setup(request =>
request.Invoke(httpContext))
- .ThrowsAsync(thrownException);
+ .ThrowsAsync(thrownException);
Exception actualException =
await Record.ExceptionAsync(() =>
@@ -49,7 +48,7 @@ await Record.ExceptionAsync(() =>
ProblemDetails actualErrorResponse = await GetErrorResponseFromBody(memoryStream);
// Should be null since error is caught
- actualException.Should().BeNull();
+ Assert.Null(actualException);
Assert.Equal(expectedMessage, actualErrorResponse.Detail);
Assert.Equal(expectedInstance, actualErrorResponse.Instance);
@@ -80,11 +79,11 @@ public async Task Invoke_ShouldReturnClientMessageInsteadOfExceptionMessage()
// IOptionsMonitor should not be called
// This will cause a null reference exception and fail test if called
- IOptionsMonitor emptyOptionsMonitor = default;
+ IOptionsMonitor emptyOptionsMonitor = null;
requestDelegateMock.Setup(request =>
request.Invoke(httpContext))
- .ThrowsAsync(thrownException);
+ .ThrowsAsync(thrownException);
Exception actualException =
await Record.ExceptionAsync(() =>
@@ -97,7 +96,7 @@ await Record.ExceptionAsync(() =>
ProblemDetails actualErrorResponse = await GetErrorResponseFromBody(memoryStream);
// Should be null since error is caught
- actualException.Should().BeNull();
+ Assert.Null(actualException);
// Check only client message is seen by consumer
Assert.Equal(externalClientMessage, actualErrorResponse.Detail);
diff --git a/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.ProblemDetail.cs b/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.ProblemDetail.cs
index e1b1029..6bfdb62 100644
--- a/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.ProblemDetail.cs
+++ b/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.ProblemDetail.cs
@@ -6,7 +6,6 @@
using BlazorFocused.Exceptions.Middleware.ApplicationBuilder;
using BlazorFocused.Exceptions.Middleware.ExceptionBuilder;
using Bogus;
-using FluentAssertions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging.Abstractions;
@@ -43,7 +42,7 @@ await Record.ExceptionAsync(() =>
ProblemDetails actualErrorResponse = await GetErrorResponseFromBody(memoryStream);
// Should be null since error is caught
- actualException.Should().BeNull();
+ Assert.Null(actualException);
Assert.Equal(exceptionsMiddlewareOptions.DefaultErrorMessage, actualErrorResponse.Detail);
Assert.Equal(expectedInstance, actualErrorResponse.Instance);
@@ -87,7 +86,7 @@ await Record.ExceptionAsync(() =>
ProblemDetails actualErrorResponse = await GetErrorResponseFromBody(memoryStream);
// Should be null since error is caught
- actualException.Should().BeNull();
+ Assert.Null(actualException);
Assert.Equal(expectedMessage, actualErrorResponse.Detail);
Assert.Equal(expectedInstance, actualErrorResponse.Instance);
@@ -139,7 +138,7 @@ await Record.ExceptionAsync(() =>
ProblemDetails actualErrorResponse = await GetErrorResponseFromBody(memoryStream);
// Should be null since error is caught
- actualException.Should().BeNull();
+ Assert.Null(actualException);
Assert.Equal(expectedMessage, actualErrorResponse.Detail);
Assert.NotEqual(exceptionMessage, actualErrorResponse.Detail);
@@ -194,7 +193,7 @@ await Record.ExceptionAsync(() =>
ProblemDetails actualErrorResponse = await GetErrorResponseFromBody(memoryStream);
// Should be null since error is caught
- actualException.Should().BeNull();
+ Assert.Null(actualException);
Assert.Equal(expectedDetail, actualErrorResponse.Detail);
Assert.Equal(expectedInstance, actualErrorResponse.Instance);
diff --git a/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.ValidationProblemDetail.cs b/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.ValidationProblemDetail.cs
index 98c23b9..0a4a0f0 100644
--- a/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.ValidationProblemDetail.cs
+++ b/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.ValidationProblemDetail.cs
@@ -3,16 +3,15 @@
// Licensed under the MIT License
// -------------------------------------------------------
+using BlazorFocused.Exceptions.Middleware.ApplicationBuilder;
+using BlazorFocused.Exceptions.Middleware.ExceptionBuilder;
using Bogus;
-using FluentAssertions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using Moq;
using System.Net;
-using BlazorFocused.Exceptions.Middleware.ApplicationBuilder;
-using BlazorFocused.Exceptions.Middleware.ExceptionBuilder;
namespace BlazorFocused.Exceptions.Middleware.Test.ApplicationBuilder;
@@ -20,7 +19,8 @@ public partial class ApplicationBuilderMiddlewareTests
{
[Theory]
[MemberData(nameof(ExceptionsWithStatusCode))]
- public async Task Invoke_ShouldReturnValidationProblemDetails(Exception thrownException, HttpStatusCode expectedStatusCode)
+ public async Task Invoke_ShouldReturnValidationProblemDetails(Exception thrownException,
+ HttpStatusCode expectedStatusCode)
{
// Adding data to exception should signal use of Problem Details
thrownException.Data.Add("TestField1", "TestValue1");
@@ -45,7 +45,7 @@ public async Task Invoke_ShouldReturnValidationProblemDetails(Exception thrownEx
requestDelegateMock.Setup(request =>
request.Invoke(httpContext))
- .ThrowsAsync(thrownException);
+ .ThrowsAsync(thrownException);
Exception actualException =
await Record.ExceptionAsync(() =>
@@ -64,7 +64,7 @@ await Record.ExceptionAsync(() =>
Assert.Equal("TestValue3", actualErrorResponse.Errors["TestField3"].First());
// Should be null since error is caught
- actualException.Should().BeNull();
+ Assert.Null(actualException);
Assert.Equal(expectedMessage, actualErrorResponse.Detail);
Assert.Equal(expectedInstance, actualErrorResponse.Instance);
diff --git a/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.cs b/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.cs
index c569804..49178c2 100644
--- a/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.cs
+++ b/src/Middleware/test/ApplicationBuilder/ApplicationBuilderMiddlewareTests.cs
@@ -3,6 +3,8 @@
// Licensed under the MIT License
// -------------------------------------------------------
+using BlazorFocused.Exceptions.Middleware.ApplicationBuilder;
+using BlazorFocused.Exceptions.Middleware.ExceptionBuilder;
using Bogus;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
@@ -11,8 +13,6 @@
using System.Net;
using System.Text;
using System.Text.Json;
-using BlazorFocused.Exceptions.Middleware.ApplicationBuilder;
-using BlazorFocused.Exceptions.Middleware.ExceptionBuilder;
using Xunit.Sdk;
namespace BlazorFocused.Exceptions.Middleware.Test.ApplicationBuilder;
diff --git a/src/Middleware/test/BlazorFocused.Exceptions.Middleware.Test.csproj b/src/Middleware/test/BlazorFocused.Exceptions.Middleware.Test.csproj
index 7a8d36d..2e4a82d 100644
--- a/src/Middleware/test/BlazorFocused.Exceptions.Middleware.Test.csproj
+++ b/src/Middleware/test/BlazorFocused.Exceptions.Middleware.Test.csproj
@@ -1,7 +1,7 @@
- net8.0;net9.0
+ net10.0
false
true
@@ -20,11 +20,10 @@
-
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
diff --git a/src/Middleware/test/ExceptionsBuilder/ExceptionDataHelperTests.cs b/src/Middleware/test/ExceptionsBuilder/ExceptionDataHelperTests.cs
index 327f954..5121bc2 100644
--- a/src/Middleware/test/ExceptionsBuilder/ExceptionDataHelperTests.cs
+++ b/src/Middleware/test/ExceptionsBuilder/ExceptionDataHelperTests.cs
@@ -3,11 +3,10 @@
// Licensed under the MIT License
// -------------------------------------------------------
+using BlazorFocused.Exceptions.Middleware.ExceptionBuilder;
using Bogus;
-using FluentAssertions;
using Microsoft.AspNetCore.Mvc;
using System.Text.Json;
-using BlazorFocused.Exceptions.Middleware.ExceptionBuilder;
namespace BlazorFocused.Exceptions.Middleware.Test.ExceptionsBuilder;
@@ -52,8 +51,8 @@ public void SetValidationDetailsFromExceptionData_ShouldAddArrayOfStrings()
Assert.NotEmpty(problemDetails.Errors);
Assert.Equal(2, problemDetails.Errors.Count);
- problemDetails.Errors[firstArrayKey].Should().BeEquivalentTo(firstArrayOfStrings);
- problemDetails.Errors[secondArrayKey].Should().BeEquivalentTo(secondArrayOfStrings);
+ Assert.Equivalent(firstArrayOfStrings, problemDetails.Errors[firstArrayKey]);
+ Assert.Equivalent(secondArrayOfStrings, problemDetails.Errors[secondArrayKey]);
}
[Fact]
@@ -76,8 +75,8 @@ public void SetValidationDetailsFromExceptionData_ShouldAddListOfStrings()
Assert.NotEmpty(problemDetails.Errors);
Assert.Equal(2, problemDetails.Errors.Count);
- problemDetails.Errors[firstArrayKey].Should().BeEquivalentTo(firstArrayOfStrings);
- problemDetails.Errors[secondArrayKey].Should().BeEquivalentTo(secondArrayOfStrings);
+ Assert.Equivalent(firstArrayOfStrings, problemDetails.Errors[firstArrayKey]);
+ Assert.Equivalent(secondArrayOfStrings, problemDetails.Errors[secondArrayKey]);
}
[Fact]
@@ -112,7 +111,11 @@ public void SetValidationDetailsFromExceptionData_ShouldAddArrayOfSerializedObje
string inputObjectOneString = JsonSerializer.Serialize(inputObjectOne);
string inputObjectTwoString = JsonSerializer.Serialize(inputObjectTwo);
- exception.Data.Add(inputObjectKey, new TestObjectClass[] { inputObjectOne, inputObjectTwo });
+ exception.Data.Add(inputObjectKey, new[]
+ {
+ inputObjectOne,
+ inputObjectTwo
+ });
ExceptionDataHelper.SetValidationDetailsFromExceptionData(problemDetails, exception);
@@ -135,7 +138,11 @@ public void SetValidationDetailsFromExceptionData_ShouldAddListOfSerializedObjec
string inputObjectOneString = JsonSerializer.Serialize(inputObjectOne);
string inputObjectTwoString = JsonSerializer.Serialize(inputObjectTwo);
- exception.Data.Add(inputObjectKey, new List { inputObjectOne, inputObjectTwo });
+ exception.Data.Add(inputObjectKey, new List
+ {
+ inputObjectOne,
+ inputObjectTwo
+ });
ExceptionDataHelper.SetValidationDetailsFromExceptionData(problemDetails, exception);
diff --git a/src/Middleware/test/ServiceCollectionTests.cs b/src/Middleware/test/ServiceCollectionTests.cs
index 5b373a3..b68bfff 100644
--- a/src/Middleware/test/ServiceCollectionTests.cs
+++ b/src/Middleware/test/ServiceCollectionTests.cs
@@ -3,7 +3,6 @@
// Licensed under the MIT License
// -------------------------------------------------------
-using FluentAssertions;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
@@ -27,7 +26,7 @@ public void AddExceptionsMiddleware_ShouldEstablishBaseOptions()
ExceptionsMiddlewareOptions actualMiddlewareOptions =
serviceProvider.GetRequiredService>().Value;
- actualMiddlewareOptions.Should().BeEquivalentTo(expectedMiddlewareOptions);
+ Assert.Equivalent(expectedMiddlewareOptions, actualMiddlewareOptions);
}
[Fact]
@@ -60,7 +59,9 @@ public void AddExceptionsMiddleware_ShouldChangeBaseOptions()
ExceptionsMiddlewareOptions actualMiddlewareOptions =
serviceProvider.GetRequiredService>().Value;
- actualMiddlewareOptions.Should().BeEquivalentTo(expectedMiddlewareOptions);
+ Assert.Equivalent(expectedMiddlewareOptions, actualMiddlewareOptions);
+
+ return;
static string ConfigureCorrelation(HttpContext httpContext)
{