Skip to content

Commit 762bb4f

Browse files
committed
Fix broken test, adjust message
1 parent 80a6875 commit 762bb4f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/JsonApiDotNetCore/Configuration/ApplicationBuilderExtensions.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ private static void AssertAspNetCoreOpenApiIsNotRegistered(IServiceProvider serv
6262
if (configureInstance != null)
6363
{
6464
throw new InvalidConfigurationException("JsonApiDotNetCore is incompatible with ASP.NET OpenAPI. " +
65-
"Replace 'services.AddOpenApi()' with 'services.AddOpenApiForJsonApi()' from the JsonApiDotNetCore.OpenApi.Swashbuckle NuGet package.");
65+
"Remove 'services.AddOpenApi()', or replace it by calling 'services.AddOpenApiForJsonApi()' after 'services.AddJsonApi()' " +
66+
"from the JsonApiDotNetCore.OpenApi.Swashbuckle NuGet package.");
6667
}
6768
}
6869
}

test/DiscoveryTests/AspNetOpenApiTests.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#if !NET8_0
22
using FluentAssertions;
33
using JsonApiDotNetCore.Configuration;
4+
using JsonApiDotNetCore.Errors;
45
using Microsoft.AspNetCore.Builder;
56
using Microsoft.AspNetCore.TestHost;
67
using Microsoft.Extensions.DependencyInjection;
@@ -24,8 +25,9 @@ public async Task Throws_when_AspNet_OpenApi_is_registered()
2425
Action action = app.UseJsonApi;
2526

2627
// Assert
27-
action.Should().ThrowExactly<InvalidOperationException>().WithMessage("JsonApiDotNetCore is incompatible with ASP.NET OpenAPI. " +
28-
"Replace 'services.AddOpenApi()' with 'services.AddOpenApiForJsonApi()' from the JsonApiDotNetCore.OpenApi.Swashbuckle NuGet package.");
28+
action.Should().ThrowExactly<InvalidConfigurationException>().WithMessage("JsonApiDotNetCore is incompatible with ASP.NET OpenAPI. " +
29+
"Remove 'services.AddOpenApi()', or replace it by calling 'services.AddOpenApiForJsonApi()' after 'services.AddJsonApi()' " +
30+
"from the JsonApiDotNetCore.OpenApi.Swashbuckle NuGet package.");
2931
}
3032
}
3133
#endif

0 commit comments

Comments
 (0)