diff --git a/src/JsonApiDotNetCore/Configuration/JsonApiApplicationBuilder.cs b/src/JsonApiDotNetCore/Configuration/JsonApiApplicationBuilder.cs index dd844be361..151a183737 100644 --- a/src/JsonApiDotNetCore/Configuration/JsonApiApplicationBuilder.cs +++ b/src/JsonApiDotNetCore/Configuration/JsonApiApplicationBuilder.cs @@ -107,7 +107,7 @@ public void ConfigureMvc() if (_options.ValidateModelState) { _mvcBuilder.AddDataAnnotations(); - _services.Replace(new ServiceDescriptor(typeof(IModelMetadataProvider), typeof(JsonApiModelMetadataProvider), ServiceLifetime.Singleton)); + _services.Replace(ServiceDescriptor.Singleton()); } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsContentTypeTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsContentTypeTests.cs index 1a173b616c..303358e105 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsContentTypeTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/CustomExtensions/CustomExtensionsContentTypeTests.cs @@ -8,7 +8,6 @@ using JsonApiDotNetCore.Serialization.Request.Adapters; using JsonApiDotNetCore.Serialization.Response; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; using TestBuildingBlocks; using Xunit; @@ -40,10 +39,9 @@ public CustomExtensionsContentTypeTests(IntegrationTestContext(); return new CapturingDocumentAdapter(documentAdapter, requestDocumentStore); }); - }); - testContext.PostConfigureServices(services => services.Replace( - ServiceDescriptor.Singleton(new FrozenTimeProvider(CurrentTime, TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time"))))); + services.AddSingleton(new FrozenTimeProvider(CurrentTime, TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time"))); + }); var options = (JsonApiOptions)_testContext.Factory.Services.GetRequiredService(); #pragma warning disable CS0618 // Type or member is obsolete diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs index 9385ffa4fc..48d1bfce4f 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs @@ -4,7 +4,6 @@ using JsonApiDotNetCore.Serialization.Objects; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; using TestBuildingBlocks; using Xunit; @@ -26,7 +25,7 @@ public ResourceInjectionTests(IntegrationTestContext(); testContext.UseController(); - testContext.PostConfigureServices(services => services.Replace(ServiceDescriptor.Singleton(new FrozenTimeProvider(CurrentTime)))); + testContext.ConfigureServices(services => services.AddSingleton(new FrozenTimeProvider(CurrentTime))); var timeProvider = (FrozenTimeProvider)testContext.Factory.Services.GetRequiredService(); timeProvider.Reset(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionTests.cs index 71cab6bdb3..0021e1a545 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionTests.cs @@ -5,7 +5,6 @@ using JsonApiDotNetCore.Serialization.Objects; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; using TestBuildingBlocks; using Xunit; @@ -30,9 +29,9 @@ public SoftDeletionTests(IntegrationTestContext>(); services.AddResourceService>(); - }); - testContext.PostConfigureServices(services => services.Replace(ServiceDescriptor.Singleton(new FrozenTimeProvider(CurrentTime)))); + services.AddSingleton(new FrozenTimeProvider(CurrentTime)); + }); var timeProvider = (FrozenTimeProvider)testContext.Factory.Services.GetRequiredService(); timeProvider.Reset(); diff --git a/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj b/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj index 497a65d05e..2d7d435da6 100644 --- a/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj +++ b/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj @@ -1,4 +1,4 @@ - + net10.0 @@ -23,113 +23,113 @@ - + AtomicOperations $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client - ./%(Name)/GeneratedCode + .\%(Name)\GeneratedCode $(JsonApiExtraArguments) - + AttributeTypes $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client - ./%(Name)/GeneratedCode + .\%(Name)\GeneratedCode $(JsonApiExtraArguments) - + ClientIdGenerationModes $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client - ./%(Name)/GeneratedCode + .\%(Name)\GeneratedCode $(JsonApiExtraArguments) - + CustomRoutes $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client - ./%(Name)/GeneratedCode + .\%(Name)\GeneratedCode $(JsonApiExtraArguments) - + Headers $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client - ./%(Name)/GeneratedCode + .\%(Name)\GeneratedCode $(JsonApiExtraArguments) - + IdObfuscation $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client - ./%(Name)/GeneratedCode + .\%(Name)\GeneratedCode $(JsonApiExtraArguments) - + Links $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client - ./%(Name)/GeneratedCode + .\%(Name)\GeneratedCode $(JsonApiExtraArguments) - + MixedControllers $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client - ./%(Name)/GeneratedCode + .\%(Name)\GeneratedCode $(JsonApiExtraArguments) - + ModelStateValidation $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client - ./%(Name)/GeneratedCode + .\%(Name)\GeneratedCode $(JsonApiExtraArguments) - + QueryStrings $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client - ./%(Name)/GeneratedCode + .\%(Name)\GeneratedCode $(JsonApiExtraArguments) - + ResourceInheritance NoOperations $(MSBuildProjectName).%(Subcategory).%(Name).GeneratedCode %(Name)InheritanceClient - ./%(Subcategory)/%(Name)/GeneratedCode + .\%(Subcategory)\%(Name)\GeneratedCode $(JsonApiExtraArguments) - + ResourceInheritance OnlyRelationships $(MSBuildProjectName).%(Subcategory).%(Name).GeneratedCode %(Name)InheritanceClient - ./%(Subcategory)/%(Name)/GeneratedCode + .\%(Subcategory)\%(Name)\GeneratedCode $(JsonApiExtraArguments) - + ResourceInheritance SubsetOfOperations $(MSBuildProjectName).%(Subcategory).%(Name).GeneratedCode %(Name)InheritanceClient - ./%(Subcategory)/%(Name)/GeneratedCode + .\%(Subcategory)\%(Name)\GeneratedCode $(JsonApiExtraArguments) - + ResourceInheritance SubsetOfVarious $(MSBuildProjectName).%(Subcategory).%(Name).GeneratedCode %(Name)InheritanceClient - ./%(Subcategory)/%(Name)/GeneratedCode + .\%(Subcategory)\%(Name)\GeneratedCode $(JsonApiExtraArguments) - + RestrictedControllers $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client - ./%(Name)/GeneratedCode + .\%(Name)\GeneratedCode $(JsonApiExtraArguments) diff --git a/test/OpenApiNSwagClientTests/OpenApiNSwagClientTests.csproj b/test/OpenApiNSwagClientTests/OpenApiNSwagClientTests.csproj index 552d4e74c1..c7ae77200c 100644 --- a/test/OpenApiNSwagClientTests/OpenApiNSwagClientTests.csproj +++ b/test/OpenApiNSwagClientTests/OpenApiNSwagClientTests.csproj @@ -1,4 +1,4 @@ - + net10.0 @@ -27,7 +27,7 @@ - + $(MSBuildProjectName).LegacyOpenApi.GeneratedCode LegacyClient %(ClassName).cs @@ -35,25 +35,25 @@ false false - + KebabCase $(MSBuildProjectName).NamingConventions.%(Name).GeneratedCode %(Name)Client %(ClassName).cs - + CamelCase $(MSBuildProjectName).NamingConventions.%(Name).GeneratedCode %(Name)Client %(ClassName).cs - + PascalCase $(MSBuildProjectName).NamingConventions.%(Name).GeneratedCode %(Name)Client %(ClassName).cs - + NrtOffMsvOff $(MSBuildProjectName).ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOff.GeneratedCode %(Name)Client @@ -62,7 +62,7 @@ false false - + NrtOffMsvOn $(MSBuildProjectName).ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOn.GeneratedCode %(Name)Client @@ -71,7 +71,7 @@ false false - + NrtOnMsvOff $(MSBuildProjectName).ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOff.GeneratedCode %(Name)Client @@ -80,7 +80,7 @@ false false - + NrtOnMsvOn $(MSBuildProjectName).ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOn.GeneratedCode %(Name)Client diff --git a/test/OpenApiNSwagEndToEndTests/OpenApiNSwagEndToEndTests.csproj b/test/OpenApiNSwagEndToEndTests/OpenApiNSwagEndToEndTests.csproj index e23061623f..9d5f5e0e1f 100644 --- a/test/OpenApiNSwagEndToEndTests/OpenApiNSwagEndToEndTests.csproj +++ b/test/OpenApiNSwagEndToEndTests/OpenApiNSwagEndToEndTests.csproj @@ -27,92 +27,92 @@ - + AtomicOperations $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client %(ClassName).cs - + AttributeTypes $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client %(ClassName).cs - + ClientIdGenerationModes $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client %(ClassName).cs - + CustomRoutes $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client %(ClassName).cs - + Headers $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client %(ClassName).cs true - + IdObfuscation $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client %(ClassName).cs - + Links $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client %(ClassName).cs - + MixedControllers $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client %(ClassName).cs - + ModelStateValidation $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client %(ClassName).cs - + QueryStrings $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client %(ClassName).cs - + NoOperationsInheritance $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client %(ClassName).cs - + OnlyRelationshipsInheritance $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client %(ClassName).cs - + SubsetOfOperationsInheritance $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client %(ClassName).cs - + SubsetOfVariousInheritance $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client %(ClassName).cs - + RestrictedControllers $(MSBuildProjectName).%(Name).GeneratedCode %(Name)Client diff --git a/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/AtomicOperations/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/AtomicOperations/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/AtomicOperations/OperationsTests.cs b/test/OpenApiTests/AtomicOperations/OperationsTests.cs index b7698f132d..82e2f63731 100644 --- a/test/OpenApiTests/AtomicOperations/OperationsTests.cs +++ b/test/OpenApiTests/AtomicOperations/OperationsTests.cs @@ -18,7 +18,7 @@ public OperationsTests(OpenApiTestContext, O testContext.UseController(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService(); options.IncludeJsonApiVersion = true; @@ -28,7 +28,7 @@ public OperationsTests(OpenApiTestContext, O public async Task Operations_endpoint_is_exposed() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./operations.post").Should().BeJson(""" @@ -126,7 +126,7 @@ public async Task Operations_endpoint_is_exposed() public async Task Operations_request_component_schemas_are_exposed() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas").With(schemasElement => @@ -364,7 +364,7 @@ public async Task Operations_request_component_schemas_are_exposed() public async Task Operations_response_component_schemas_are_exposed() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas").With(schemasElement => @@ -439,7 +439,7 @@ public async Task Operations_response_component_schemas_are_exposed() public async Task Course_operation_component_schemas_are_exposed() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas").With(schemasElement => @@ -905,7 +905,7 @@ public async Task Course_operation_component_schemas_are_exposed() public async Task Student_operation_component_schemas_are_exposed() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas").With(schemasElement => @@ -1475,7 +1475,7 @@ public async Task Student_operation_component_schemas_are_exposed() public async Task Teacher_operation_component_schemas_are_exposed() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas").With(schemasElement => @@ -1989,7 +1989,7 @@ public async Task Teacher_operation_component_schemas_are_exposed() public async Task Enrollment_operation_component_schemas_are_exposed() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas").With(schemasElement => diff --git a/test/OpenApiTests/AttributeTypes/AttributeTypeTests.cs b/test/OpenApiTests/AttributeTypes/AttributeTypeTests.cs index 5747c62726..e196655501 100644 --- a/test/OpenApiTests/AttributeTypes/AttributeTypeTests.cs +++ b/test/OpenApiTests/AttributeTypes/AttributeTypeTests.cs @@ -26,7 +26,7 @@ public AttributeTypeTests(OpenApiTestContext(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; } [Theory] @@ -34,7 +34,7 @@ public AttributeTypeTests(OpenApiTestContext diff --git a/test/OpenApiTests/Capabilities/AllowCreateChangeTests.cs b/test/OpenApiTests/Capabilities/AllowCreateChangeTests.cs index c294f54974..0009e45682 100644 --- a/test/OpenApiTests/Capabilities/AllowCreateChangeTests.cs +++ b/test/OpenApiTests/Capabilities/AllowCreateChangeTests.cs @@ -23,7 +23,7 @@ public AllowCreateChangeTests(OpenApiTestContext, C public async Task Hides_readonly_attribute_property_in_response() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert const string fieldReadOnlyName = "attributeReadOnly"; @@ -51,7 +51,7 @@ public async Task Hides_readonly_attribute_property_in_response() public async Task Hides_ToOne_relationship_property_in_create_and_update_resource_request() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert const string fieldOnName = "parentSetOn"; @@ -80,7 +80,7 @@ public async Task Hides_ToOne_relationship_property_in_create_and_update_resourc public async Task Hides_update_ToOne_relationship_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./allowSetCapabilities/{id}/relationships/parentSetOn").With(endpointElement => @@ -102,7 +102,7 @@ public async Task Hides_update_ToOne_relationship_endpoint() public async Task Hides_ToMany_relationship_property_in_create_and_update_resource_request() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert const string fieldOnName = "childrenSetOn"; @@ -131,7 +131,7 @@ public async Task Hides_ToMany_relationship_property_in_create_and_update_resour public async Task Hides_update_ToMany_relationship_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./allowSetCapabilities/{id}/relationships/childrenSetOn").With(endpointElement => diff --git a/test/OpenApiTests/Capabilities/AllowViewTests.cs b/test/OpenApiTests/Capabilities/AllowViewTests.cs index 971e97a6de..95f96e2a4c 100644 --- a/test/OpenApiTests/Capabilities/AllowViewTests.cs +++ b/test/OpenApiTests/Capabilities/AllowViewTests.cs @@ -22,7 +22,7 @@ public AllowViewTests(OpenApiTestContext, public async Task Hides_attribute_property_in_response() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert const string fieldOnName = "attributeViewOn"; @@ -51,7 +51,7 @@ public async Task Hides_attribute_property_in_response() public async Task Hides_ToOne_relationship_property_in_response() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert const string fieldOnName = "parentViewOn"; @@ -80,7 +80,7 @@ public async Task Hides_ToOne_relationship_property_in_response() public async Task Hides_get_ToOne_relationship_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./allowViewCapabilities/{id}/relationships/parentViewOn").With(endpointElement => @@ -102,7 +102,7 @@ public async Task Hides_get_ToOne_relationship_endpoint() public async Task Hides_ToMany_relationship_property_in_response() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert const string fieldOnName = "childrenViewOn"; @@ -131,7 +131,7 @@ public async Task Hides_ToMany_relationship_property_in_response() public async Task Hides_get_ToMany_relationship_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./allowViewCapabilities/{id}/relationships/childrenViewOn").With(endpointElement => diff --git a/test/OpenApiTests/ClientIdGenerationModes/ClientIdGenerationTests.cs b/test/OpenApiTests/ClientIdGenerationModes/ClientIdGenerationTests.cs index 91f6e20ee4..884fa6cd17 100644 --- a/test/OpenApiTests/ClientIdGenerationModes/ClientIdGenerationTests.cs +++ b/test/OpenApiTests/ClientIdGenerationModes/ClientIdGenerationTests.cs @@ -19,14 +19,14 @@ public ClientIdGenerationTests(OpenApiTestContext(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; } [Fact] public async Task Schema_property_for_ID_is_required_in_post_request() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.dataInCreatePlayerRequest.allOf[1]").With(dataElement => @@ -45,7 +45,7 @@ public async Task Schema_property_for_ID_is_required_in_post_request() public async Task Schema_property_for_ID_is_optional_in_post_request() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.dataInCreateGameRequest.allOf[1]").With(dataElement => @@ -58,7 +58,7 @@ public async Task Schema_property_for_ID_is_optional_in_post_request() public async Task Schema_property_for_ID_is_omitted_in_post_request() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.dataInCreatePlayerGroupRequest.allOf[1]").With(dataElement => diff --git a/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/CustomRoutes/CustomRouteTests.cs b/test/OpenApiTests/CustomRoutes/CustomRouteTests.cs index a7a6273e92..89c392e84f 100644 --- a/test/OpenApiTests/CustomRoutes/CustomRouteTests.cs +++ b/test/OpenApiTests/CustomRoutes/CustomRouteTests.cs @@ -22,7 +22,7 @@ public CustomRouteTests(OpenApiTestContext, testContext.UseController(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; } [Theory] @@ -41,7 +41,7 @@ public async Task Only_expected_endpoints_are_exposed(Type resourceClrType, stri IReadOnlyDictionary> defaultEndpointToPathMap = JsonPathBuilder.GetEndpointPaths(resourceType); // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string[] customPaths = JsonPathBuilder.KnownEndpoints.SelectMany(endpoint => customEndpointToPathMap[endpoint]).ToArray(); @@ -62,7 +62,7 @@ public async Task Only_expected_endpoints_are_exposed(Type resourceClrType, stri public async Task Winner_endpoint_is_exposed() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./voting-api/overview/winner/{id}").Should().BeJson(""" diff --git a/test/OpenApiTests/CustomRoutes/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/CustomRoutes/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/CustomRoutes/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/CustomRoutes/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/Documentation/DocumentationTests.cs b/test/OpenApiTests/Documentation/DocumentationTests.cs index b887cf9b08..8a078955c6 100644 --- a/test/OpenApiTests/Documentation/DocumentationTests.cs +++ b/test/OpenApiTests/Documentation/DocumentationTests.cs @@ -44,7 +44,7 @@ public DocumentationTests(OpenApiTestContext @@ -71,7 +71,7 @@ public async Task API_is_documented() public async Task Endpoints_are_documented() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./skyscrapers").With(skyscrapersElement => @@ -639,7 +639,7 @@ public async Task Endpoints_are_documented() public async Task Applies_restrictions_from_DisableQueryString_annotation_on_controller(string endpointPath, JsonApiQueryStringParameters queryStringParameters) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"paths.{endpointPath}.parameters").With(parametersElement => @@ -683,7 +683,7 @@ public async Task Applies_restrictions_from_DisableQueryString_annotation_on_con public async Task Resource_types_are_documented() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas").With(schemasElement => @@ -706,7 +706,7 @@ public async Task Resource_types_are_documented() public async Task Attributes_are_documented() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas").With(schemasElement => @@ -743,7 +743,7 @@ public async Task Attributes_are_documented() public async Task Relationships_are_documented() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas").With(schemasElement => @@ -780,7 +780,7 @@ public async Task Relationships_are_documented() public async Task Enums_are_documented() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas").With(schemasElement => @@ -793,7 +793,7 @@ public async Task Enums_are_documented() public async Task Forbidden_status_is_added_when_client_generated_IDs_are_disabled() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./elevators.post.responses").With(responsesElement => diff --git a/test/OpenApiTests/Documentation/ErrorResponseTests.cs b/test/OpenApiTests/Documentation/ErrorResponseTests.cs index 37ebf4ecbc..6e4da7895e 100644 --- a/test/OpenApiTests/Documentation/ErrorResponseTests.cs +++ b/test/OpenApiTests/Documentation/ErrorResponseTests.cs @@ -32,7 +32,7 @@ public ErrorResponseTests(OpenApiTestContext @@ -308,7 +308,7 @@ public async Task Applicable_error_status_codes_with_schema_are_provided_on_endp public async Task Forbidden_status_is_added_when_client_generated_IDs_are_disabled() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./elevators.post.responses").With(responsesElement => diff --git a/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/Headers/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/Headers/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/Headers/HeaderTests.cs b/test/OpenApiTests/Headers/HeaderTests.cs index 4e363b2c89..0c54a2c380 100644 --- a/test/OpenApiTests/Headers/HeaderTests.cs +++ b/test/OpenApiTests/Headers/HeaderTests.cs @@ -17,7 +17,7 @@ public HeaderTests(OpenApiTestContext, HeaderDbC testContext.UseController(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; } [Theory] @@ -32,7 +32,7 @@ public HeaderTests(OpenApiTestContext, HeaderDbC public async Task Endpoints_have_caching_headers(string endpointPath) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"paths.{endpointPath}.parameters").With(parametersElement => @@ -82,7 +82,7 @@ static void AssertETag(JsonElement etagElement) public async Task Endpoints_do_not_have_caching_headers(string endpointPath) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"paths.{endpointPath}.parameters").With(parametersElement => @@ -107,7 +107,7 @@ public async Task Endpoints_do_not_have_caching_headers(string endpointPath) public async Task Endpoints_have_content_length_response_header(string endpointPath) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"paths.{endpointPath}.responses.200.headers.Content-Length").With(contentLengthElement => @@ -128,7 +128,7 @@ public async Task Endpoints_have_content_length_response_header(string endpointP public async Task Post_resource_endpoint_has_location_response_header() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./countries.post.responses.201.headers.Location").With(locationElement => diff --git a/test/OpenApiTests/IdObfuscation/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/IdObfuscation/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/IdObfuscation/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/IdObfuscation/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/IdObfuscation/IdObfuscationTests.cs b/test/OpenApiTests/IdObfuscation/IdObfuscationTests.cs index f37eed8cf7..8c7311b14f 100644 --- a/test/OpenApiTests/IdObfuscation/IdObfuscationTests.cs +++ b/test/OpenApiTests/IdObfuscation/IdObfuscationTests.cs @@ -19,7 +19,7 @@ public IdObfuscationTests(OpenApiTestContext(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; } [Theory] @@ -46,7 +46,7 @@ public IdObfuscationTests(OpenApiTestContext @@ -79,7 +79,7 @@ public async Task Hides_underlying_ID_type_in_path_parameter(string endpointPath public async Task Hides_underlying_ID_type_in_component_schema(string schemaId, bool isWrapped) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string path = isWrapped ? $"components.schemas.{schemaId}.allOf[1].properties.id" : $"components.schemas.{schemaId}.properties.id"; diff --git a/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/LegacyOpenApi/LegacyTests.cs b/test/OpenApiTests/LegacyOpenApi/LegacyTests.cs index 84db211242..3e7ebd00f1 100644 --- a/test/OpenApiTests/LegacyOpenApi/LegacyTests.cs +++ b/test/OpenApiTests/LegacyOpenApi/LegacyTests.cs @@ -18,14 +18,14 @@ public LegacyTests(ITestOutputHelper testOutputHelper) UseController(); SetTestOutputHelper(testOutputHelper); - SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; } [Fact] public async Task Retrieved_swagger_document_matches_expected_document() { // Act - JsonElement jsonElement = await GetSwaggerDocumentAsync(); + JsonElement jsonElement = await GetOpenApiDocumentAsync(); // Assert string expectedJsonText = await GetExpectedSwaggerDocumentAsync(); diff --git a/test/OpenApiTests/Links/Disabled/LinksDisabledTests.cs b/test/OpenApiTests/Links/Disabled/LinksDisabledTests.cs index c236ef9b61..e5fa71341f 100644 --- a/test/OpenApiTests/Links/Disabled/LinksDisabledTests.cs +++ b/test/OpenApiTests/Links/Disabled/LinksDisabledTests.cs @@ -41,7 +41,7 @@ public LinksDisabledTests(OpenApiTestContext, Link public async Task All_configurable_link_schemas_are_hidden(string schemaId) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas").With(schemasElement => @@ -54,7 +54,7 @@ public async Task All_configurable_link_schemas_are_hidden(string schemaId) public async Task Error_links_schema_is_visible() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.errorLinks").With(linksElement => @@ -97,7 +97,7 @@ public async Task Error_links_schema_is_visible() public async Task All_container_schemas_contain_no_link_property(string containerSchemaId) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas").With(schemasElement => diff --git a/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/Links/Enabled/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/Links/Enabled/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/Links/Enabled/LinksEnabledTests.cs b/test/OpenApiTests/Links/Enabled/LinksEnabledTests.cs index ba476b5756..498d09be8d 100644 --- a/test/OpenApiTests/Links/Enabled/LinksEnabledTests.cs +++ b/test/OpenApiTests/Links/Enabled/LinksEnabledTests.cs @@ -21,7 +21,7 @@ public LinksEnabledTests(OpenApiTestContext, LinkD testContext.UseController(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; } [Theory] @@ -35,7 +35,7 @@ public LinksEnabledTests(OpenApiTestContext, LinkD public async Task All_configurable_link_schemas_are_exposed(string schemaId, LinkTypes expected) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas").With(schemasElement => @@ -80,7 +80,7 @@ public async Task All_configurable_link_schemas_are_exposed(string schemaId, Lin public async Task All_container_schemas_contain_correct_link_property(string linkSchemaId, string containerSchemaId, bool isRequired) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas").With(schemasElement => diff --git a/test/OpenApiTests/Links/Mixed/LinksMixedTests.cs b/test/OpenApiTests/Links/Mixed/LinksMixedTests.cs index 3a6be9dc32..ada7d54e0a 100644 --- a/test/OpenApiTests/Links/Mixed/LinksMixedTests.cs +++ b/test/OpenApiTests/Links/Mixed/LinksMixedTests.cs @@ -43,7 +43,7 @@ public LinksMixedTests(OpenApiTestContext, LinkDbC public async Task Expected_configurable_link_schemas_are_exposed(string schemaId, LinkTypes expected) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas").With(schemasElement => diff --git a/test/OpenApiTests/Meta/MetaTests.cs b/test/OpenApiTests/Meta/MetaTests.cs index 8159fa521b..9d69304077 100644 --- a/test/OpenApiTests/Meta/MetaTests.cs +++ b/test/OpenApiTests/Meta/MetaTests.cs @@ -30,7 +30,7 @@ public MetaTests(OpenApiTestContext, MetaDbContext public async Task Includes_meta_definition() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.meta").With(metaElement => @@ -91,7 +91,7 @@ public async Task Includes_meta_definition() public async Task Includes_meta_property(string schemaId) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"components.schemas.{schemaId}.properties").With(propertiesElement => diff --git a/test/OpenApiTests/MixedControllers/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/MixedControllers/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/MixedControllers/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/MixedControllers/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/MixedControllers/MixedControllerTests.cs b/test/OpenApiTests/MixedControllers/MixedControllerTests.cs index ed40bd3886..2241db8c39 100644 --- a/test/OpenApiTests/MixedControllers/MixedControllerTests.cs +++ b/test/OpenApiTests/MixedControllers/MixedControllerTests.cs @@ -21,7 +21,7 @@ public MixedControllerTests(OpenApiTestContext(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; testContext.ConfigureServices(services => { @@ -35,7 +35,7 @@ public MixedControllerTests(OpenApiTestContext(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; } [Theory] @@ -35,7 +35,7 @@ public ModelStateValidationTests(OpenApiTestContext @@ -50,7 +50,7 @@ public async Task Guid_type_produces_expected_schema(string modelName) public async Task Length_annotation_on_resource_string_property_produces_expected_schema(string modelName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.firstName").With(firstNameElement => @@ -66,7 +66,7 @@ public async Task Length_annotation_on_resource_string_property_produces_expecte public async Task Required_annotation_with_AllowEmptyStrings_on_resource_property_produces_expected_schema(string modelName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.lastName").With(lastNameElement => @@ -81,7 +81,7 @@ public async Task Required_annotation_with_AllowEmptyStrings_on_resource_propert public async Task StringLength_annotation_on_resource_property_produces_expected_schema(string modelName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.userName").With(userNameElement => @@ -97,7 +97,7 @@ public async Task StringLength_annotation_on_resource_property_produces_expected public async Task RegularExpression_annotation_on_resource_property_produces_expected_schema(string modelName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.userName").With(userNameElement => @@ -112,7 +112,7 @@ public async Task RegularExpression_annotation_on_resource_property_produces_exp public async Task CreditCard_annotation_on_resource_property_produces_expected_schema(string modelName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.creditCard").With(creditCardElement => @@ -127,7 +127,7 @@ public async Task CreditCard_annotation_on_resource_property_produces_expected_s public async Task Email_annotation_on_resource_property_produces_expected_schema(string modelName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.email").With(emailElement => @@ -142,7 +142,7 @@ public async Task Email_annotation_on_resource_property_produces_expected_schema public async Task Min_max_length_annotation_on_resource_property_produces_expected_schema(string modelName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.password").With(passwordElement => @@ -159,7 +159,7 @@ public async Task Min_max_length_annotation_on_resource_property_produces_expect public async Task Phone_annotation_on_resource_property_produces_expected_schema(string modelName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.phone").With(phoneElement => @@ -174,7 +174,7 @@ public async Task Phone_annotation_on_resource_property_produces_expected_schema public async Task Range_annotation_on_resource_property_produces_expected_schema(string modelName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.age").With(ageElement => @@ -193,7 +193,7 @@ public async Task Range_annotation_on_resource_property_produces_expected_schema public async Task Url_annotation_on_resource_property_produces_expected_schema(string modelName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.profilePicture").With(profilePictureElement => @@ -208,7 +208,7 @@ public async Task Url_annotation_on_resource_property_produces_expected_schema(s public async Task Uri_type_produces_expected_schema(string modelName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.backgroundPicture").With(backgroundPictureElement => @@ -223,7 +223,7 @@ public async Task Uri_type_produces_expected_schema(string modelName) public async Task Length_annotation_on_resource_list_property_produces_expected_schema(string modelName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.tags").With(tagsElement => @@ -244,7 +244,7 @@ public async Task Length_annotation_on_resource_list_property_produces_expected_ public async Task TimeSpan_range_annotation_on_resource_property_produces_expected_schema(string modelName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.nextRevalidation").With(nextRevalidationElement => @@ -259,7 +259,7 @@ public async Task TimeSpan_range_annotation_on_resource_property_produces_expect public async Task DateTime_type_produces_expected_schema(string modelName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.validatedAt").With(validatedAtElement => @@ -274,7 +274,7 @@ public async Task DateTime_type_produces_expected_schema(string modelName) public async Task DateOnly_type_produces_expected_schema(string modelName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.validatedAtDate").With(validatedDateAtElement => @@ -289,7 +289,7 @@ public async Task DateOnly_type_produces_expected_schema(string modelName) public async Task TimeOnly_type_produces_expected_schema(string modelName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.validatedAtTime").With(validatedTimeAtElement => diff --git a/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseTests.cs b/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseTests.cs index f22f6c30ab..db24154f4f 100644 --- a/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseTests.cs +++ b/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseTests.cs @@ -24,14 +24,14 @@ public CamelCaseTests(OpenApiTestContext(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; } [Fact] public async Task Casing_convention_is_applied_to_GetCollection_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -162,7 +162,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() public async Task Casing_convention_is_applied_to_GetSingle_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -200,7 +200,7 @@ public async Task Casing_convention_is_applied_to_GetSingle_endpoint() public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_single_resource() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -237,7 +237,7 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_sin public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_nullable_resource() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}/backupStoreManager.get").With(getElement => @@ -256,7 +256,7 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_nul public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_resources() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}/cashiers.get").With(getElement => @@ -275,7 +275,7 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_res public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ToOne_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -314,7 +314,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_nullable_ToOne_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}/relationships/backupStoreManager.get").With(getElement => @@ -333,7 +333,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ToMany_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -376,7 +376,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ public async Task Casing_convention_is_applied_to_Post_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -430,7 +430,7 @@ public async Task Casing_convention_is_applied_to_Post_endpoint() public async Task Casing_convention_is_applied_to_PostRelationship_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}/relationships/cashiers.post").With(getElement => @@ -446,7 +446,7 @@ public async Task Casing_convention_is_applied_to_PostRelationship_endpoint() public async Task Casing_convention_is_applied_to_Patch_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -484,7 +484,7 @@ public async Task Casing_convention_is_applied_to_Patch_endpoint() public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_ToOne_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}/relationships/storeManager.patch").With(getElement => @@ -500,7 +500,7 @@ public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_wit public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_nullable_ToOne_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}/relationships/backupStoreManager.patch").With(getElement => @@ -516,7 +516,7 @@ public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_wit public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_ToMany_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}/relationships/cashiers.patch").With(getElement => @@ -532,7 +532,7 @@ public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_wit public async Task Casing_convention_is_applied_to_Delete_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}.delete").With(getElement => @@ -548,7 +548,7 @@ public async Task Casing_convention_is_applied_to_Delete_endpoint() public async Task Casing_convention_is_applied_to_DeleteRelationship_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}/relationships/cashiers.delete").With(getElement => @@ -564,7 +564,7 @@ public async Task Casing_convention_is_applied_to_DeleteRelationship_endpoint() public async Task Casing_convention_is_applied_to_PostOperations_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./operations.post").With(getElement => @@ -676,7 +676,7 @@ public async Task Casing_convention_is_applied_to_PostOperations_endpoint() public async Task Casing_convention_is_applied_to_error_schema() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.errorResponseDocument"); diff --git a/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseTests.cs b/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseTests.cs index 308e9c5dd0..494a160296 100644 --- a/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseTests.cs +++ b/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseTests.cs @@ -24,14 +24,14 @@ public KebabCaseTests(OpenApiTestContext(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; } [Fact] public async Task Casing_convention_is_applied_to_GetCollection_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -162,7 +162,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() public async Task Casing_convention_is_applied_to_GetSingle_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -200,7 +200,7 @@ public async Task Casing_convention_is_applied_to_GetSingle_endpoint() public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_single_resource() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -237,7 +237,7 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_sin public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_nullable_resource() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}/backup-store-manager.get").With(getElement => @@ -256,7 +256,7 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_nul public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_resources() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}/cashiers.get").With(getElement => @@ -275,7 +275,7 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_res public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ToOne_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -314,7 +314,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_nullable_ToOne_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}/relationships/backup-store-manager.get").With(getElement => @@ -333,7 +333,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ToMany_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -376,7 +376,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ public async Task Casing_convention_is_applied_to_Post_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -432,7 +432,7 @@ public async Task Casing_convention_is_applied_to_Post_endpoint() public async Task Casing_convention_is_applied_to_PostRelationship_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}/relationships/cashiers.post").With(getElement => @@ -448,7 +448,7 @@ public async Task Casing_convention_is_applied_to_PostRelationship_endpoint() public async Task Casing_convention_is_applied_to_Patch_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -486,7 +486,7 @@ public async Task Casing_convention_is_applied_to_Patch_endpoint() public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_ToOne_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}/relationships/store-manager.patch").With(getElement => @@ -502,7 +502,7 @@ public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_wit public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_nullable_ToOne_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}/relationships/backup-store-manager.patch").With(getElement => @@ -518,7 +518,7 @@ public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_wit public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_ToMany_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}/relationships/cashiers.patch").With(getElement => @@ -534,7 +534,7 @@ public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_wit public async Task Casing_convention_is_applied_to_Delete_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}.delete").With(getElement => @@ -550,7 +550,7 @@ public async Task Casing_convention_is_applied_to_Delete_endpoint() public async Task Casing_convention_is_applied_to_DeleteRelationship_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./supermarkets/{id}/relationships/cashiers.delete").With(getElement => @@ -566,7 +566,7 @@ public async Task Casing_convention_is_applied_to_DeleteRelationship_endpoint() public async Task Casing_convention_is_applied_to_PostOperations_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./operations.post").With(getElement => @@ -680,7 +680,7 @@ public async Task Casing_convention_is_applied_to_PostOperations_endpoint() public async Task Casing_convention_is_applied_to_error_schema() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.error-response-document"); diff --git a/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseTests.cs b/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseTests.cs index 0c7b7f83e2..dad3b04ed6 100644 --- a/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseTests.cs +++ b/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseTests.cs @@ -24,14 +24,14 @@ public PascalCaseTests(OpenApiTestContext(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; } [Fact] public async Task Casing_convention_is_applied_to_GetCollection_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -162,7 +162,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() public async Task Casing_convention_is_applied_to_GetSingle_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -200,7 +200,7 @@ public async Task Casing_convention_is_applied_to_GetSingle_endpoint() public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_single_resource() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -237,7 +237,7 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_sin public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_nullable_resource() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./Supermarkets/{id}/BackupStoreManager.get").With(getElement => @@ -256,7 +256,7 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_nul public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_resources() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./Supermarkets/{id}/Cashiers.get").With(getElement => @@ -275,7 +275,7 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_res public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ToOne_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -314,7 +314,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_nullable_ToOne_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./Supermarkets/{id}/relationships/BackupStoreManager.get").With(getElement => @@ -333,7 +333,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ToMany_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -376,7 +376,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ public async Task Casing_convention_is_applied_to_Post_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -430,7 +430,7 @@ public async Task Casing_convention_is_applied_to_Post_endpoint() public async Task Casing_convention_is_applied_to_PostRelationship_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./Supermarkets/{id}/relationships/Cashiers.post").With(getElement => @@ -446,7 +446,7 @@ public async Task Casing_convention_is_applied_to_PostRelationship_endpoint() public async Task Casing_convention_is_applied_to_Patch_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string? documentSchemaRefId = null; @@ -484,7 +484,7 @@ public async Task Casing_convention_is_applied_to_Patch_endpoint() public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_ToOne_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./Supermarkets/{id}/relationships/StoreManager.patch").With(getElement => @@ -500,7 +500,7 @@ public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_wit public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_nullable_ToOne_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./Supermarkets/{id}/relationships/BackupStoreManager.patch").With(getElement => @@ -516,7 +516,7 @@ public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_wit public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_ToMany_relationship() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./Supermarkets/{id}/relationships/Cashiers.patch").With(getElement => @@ -532,7 +532,7 @@ public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_wit public async Task Casing_convention_is_applied_to_Delete_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./Supermarkets/{id}.delete").With(getElement => @@ -548,7 +548,7 @@ public async Task Casing_convention_is_applied_to_Delete_endpoint() public async Task Casing_convention_is_applied_to_DeleteRelationship_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./Supermarkets/{id}/relationships/Cashiers.delete").With(getElement => @@ -564,7 +564,7 @@ public async Task Casing_convention_is_applied_to_DeleteRelationship_endpoint() public async Task Casing_convention_is_applied_to_PostOperations_endpoint() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("paths./Operations.post").With(getElement => @@ -676,7 +676,7 @@ public async Task Casing_convention_is_applied_to_PostOperations_endpoint() public async Task Casing_convention_is_applied_to_error_schema() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.ErrorResponseDocument"); diff --git a/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPatchMethodTests.cs b/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPatchMethodTests.cs index 20814f2f80..ed9168a2a9 100644 --- a/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPatchMethodTests.cs +++ b/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPatchMethodTests.cs @@ -18,7 +18,7 @@ public MissingFromBodyOnPatchMethodTests(ITestOutputHelper testOutputHelper) public async Task Cannot_use_Patch_controller_action_method_without_FromBody_attribute() { // Act - Func action = async () => _ = await GetSwaggerDocumentAsync(); + Func action = async () => _ = await GetOpenApiDocumentAsync(); // Assert string? actionMethod = typeof(MissingFromBodyOnPatchController).GetMethod(nameof(MissingFromBodyOnPatchController.AlternatePatchAsync))!.ToString(); diff --git a/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPostMethodTests.cs b/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPostMethodTests.cs index a121f058f9..637d0361ff 100644 --- a/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPostMethodTests.cs +++ b/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPostMethodTests.cs @@ -18,7 +18,7 @@ public MissingFromBodyOnPostMethodTests(ITestOutputHelper testOutputHelper) public async Task Cannot_use_Post_controller_action_method_without_FromBody_attribute() { // Act - Func action = async () => _ = await GetSwaggerDocumentAsync(); + Func action = async () => _ = await GetOpenApiDocumentAsync(); // Assert string? actionMethod = typeof(MissingFromBodyOnPostController).GetMethod(nameof(MissingFromBodyOnPostController.AlternatePostAsync))!.ToString(); diff --git a/test/OpenApiTests/OpenApiTestContext.cs b/test/OpenApiTests/OpenApiTestContext.cs index 16b7f26628..81101a8032 100644 --- a/test/OpenApiTests/OpenApiTestContext.cs +++ b/test/OpenApiTests/OpenApiTestContext.cs @@ -1,4 +1,3 @@ -using System.Reflection; using System.Text.Json; using JetBrains.Annotations; using Microsoft.Extensions.DependencyInjection; @@ -13,32 +12,29 @@ public class OpenApiTestContext : IntegrationTestContext> _lazySwaggerDocument; + private readonly Lazy> _lazyDocument; private ITestOutputHelper? _testOutputHelper; - internal string? SwaggerDocumentOutputDirectory { get; set; } + internal string? OpenApiDocumentOutputDirectory { get; set; } public OpenApiTestContext() { - _lazySwaggerDocument = new Lazy>(CreateSwaggerDocumentAsync, LazyThreadSafetyMode.ExecutionAndPublication); + _lazyDocument = new Lazy>(CreateOpenApiDocumentAsync, LazyThreadSafetyMode.ExecutionAndPublication); } - internal async Task GetSwaggerDocumentAsync() + internal async Task GetOpenApiDocumentAsync() { - return await _lazySwaggerDocument.Value; + return await _lazyDocument.Value; } - internal async Task CreateSwaggerDocumentAsync() + internal async Task CreateOpenApiDocumentAsync() { string content = await GetAsync("/swagger/v1/swagger.json"); - JsonElement rootElement = ParseSwaggerDocument(content); + JsonElement rootElement = ParseDocument(content); - if (SwaggerDocumentOutputDirectory != null) - { - string absoluteOutputPath = GetSwaggerDocumentAbsoluteOutputPath(SwaggerDocumentOutputDirectory); - await WriteToDiskAsync(absoluteOutputPath, rootElement); - } + string? absoluteOutputPath = GetAbsoluteOutputPath(); + await WriteToDiskAsync(absoluteOutputPath, rootElement); return rootElement; } @@ -60,12 +56,26 @@ private void AddXUnitProvider(ILoggingBuilder loggingBuilder) } } - private static string GetSwaggerDocumentAbsoluteOutputPath(string relativePath) + private string? GetAbsoluteOutputPath() { - string testRootDirectory = Path.Combine(Assembly.GetExecutingAssembly().Location, "../../../../../"); - string outputPath = Path.Combine(testRootDirectory, relativePath, "swagger.g.json"); + if (OpenApiDocumentOutputDirectory != null) + { +#if NET10_0 + Version frameworkVersion = typeof(object).Assembly.GetName().Version!; + string targetFrameworkName = $"net{frameworkVersion.Major}.{frameworkVersion.Minor}"; + + string testRootDirectory = Path.Combine(typeof(TDbContext).Assembly.Location, "../../../../../"); + string outputPath = Path.Combine(testRootDirectory, OpenApiDocumentOutputDirectory, targetFrameworkName, "swagger.g.json"); + + return Path.GetFullPath(outputPath); +#elif NET10_0_OR_GREATER +#error Unsupported newer target framework. Please update the preprocessor directives in this file and references in consuming projects. +#else + // Not writing to disk for simplicity and performance on lower target frameworks. +#endif + } - return Path.GetFullPath(outputPath); + return null; } private async Task GetAsync(string requestUrl) @@ -78,33 +88,40 @@ private async Task GetAsync(string requestUrl) return await responseMessage.Content.ReadAsStringAsync(); } - private static JsonElement ParseSwaggerDocument(string content) + private static JsonElement ParseDocument(string content) { using JsonDocument jsonDocument = JsonDocument.Parse(content); return jsonDocument.RootElement.Clone(); } - private static async Task WriteToDiskAsync(string path, JsonElement jsonElement) + private static async Task WriteToDiskAsync(string? path, JsonElement jsonElement) { - while (true) + if (path != null) { - try - { - string directory = Path.GetDirectoryName(path)!; - Directory.CreateDirectory(directory); + string directory = Path.GetDirectoryName(path)!; + Directory.CreateDirectory(directory); - string contents = jsonElement.ToString(); - await File.WriteAllTextAsync(path, contents); + string newContent = jsonElement.ToString(); - return; - } - catch (IOException) +#if !DEBUG + // Fail test when changes to the generated OpenAPI document haven't been committed in PRs. + bool fileExists = File.Exists(path); + string oldContent = fileExists ? await File.ReadAllTextAsync(path) : string.Empty; +#endif + + await File.WriteAllTextAsync(path, newContent); + +#if !DEBUG + if (!fileExists) { - // This sometimes happens when running tests locally. - // Multi-targeted projects should not use the same output path. + throw new InvalidOperationException($"""WARNING: File "{path}" is missing. Please commit the new file."""); + } - await Task.Delay(TimeSpan.FromMilliseconds(50)); + if (newContent != oldContent) + { + throw new InvalidOperationException($"""WARNING: File "{path}" has changed. Please commit the changes."""); } +#endif } } } diff --git a/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/QueryStrings/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/QueryStrings/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/QueryStrings/IncludeTests.cs b/test/OpenApiTests/QueryStrings/IncludeTests.cs index 78c82ad3d8..591805dbaa 100644 --- a/test/OpenApiTests/QueryStrings/IncludeTests.cs +++ b/test/OpenApiTests/QueryStrings/IncludeTests.cs @@ -34,7 +34,7 @@ public async Task Discriminator_is_generated_for_all_resource_types_when_subset_ int count = resourceGraph.GetResourceTypes().Count; // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas").With(schemasElement => diff --git a/test/OpenApiTests/QueryStrings/QueryStringTests.cs b/test/OpenApiTests/QueryStrings/QueryStringTests.cs index af897df001..9265709640 100644 --- a/test/OpenApiTests/QueryStrings/QueryStringTests.cs +++ b/test/OpenApiTests/QueryStrings/QueryStringTests.cs @@ -18,7 +18,7 @@ public QueryStringTests(OpenApiTestContext, testContext.UseController(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; } [Theory] @@ -39,7 +39,7 @@ public QueryStringTests(OpenApiTestContext, public async Task Endpoints_have_query_string_parameter(string endpointPath) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"paths.{endpointPath}").With(verbElement => @@ -77,7 +77,7 @@ public async Task Endpoints_have_query_string_parameter(string endpointPath) public async Task Endpoints_do_not_have_query_string_parameter(string endpointPath) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath($"paths.{endpointPath}").With(verbElement => diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/NullabilityTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/NullabilityTests.cs index aae027360a..7eb117bc5c 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/NullabilityTests.cs +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/NullabilityTests.cs @@ -17,7 +17,7 @@ public NullabilityTests(OpenApiTestContext, NrtOf testContext.UseController(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; } [Theory] @@ -28,7 +28,7 @@ public NullabilityTests(OpenApiTestContext, NrtOf public async Task Schema_property_for_attribute_is_nullable(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => @@ -46,7 +46,7 @@ public async Task Schema_property_for_attribute_is_nullable(string jsonPropertyN public async Task Schema_property_for_attribute_is_not_nullable(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => @@ -64,7 +64,7 @@ public async Task Schema_property_for_attribute_is_not_nullable(string jsonPrope public async Task Schema_property_for_relationship_is_nullable(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => @@ -85,7 +85,7 @@ public async Task Schema_property_for_relationship_is_nullable(string jsonProper public async Task Schema_property_for_relationship_is_not_nullable(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/RequiredTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/RequiredTests.cs index ece2c6174a..8d80f520ba 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/RequiredTests.cs +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/RequiredTests.cs @@ -25,7 +25,7 @@ public RequiredTests(OpenApiTestContext, NrtOffDb public async Task Schema_property_for_attribute_is_required_for_creating_resource(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => @@ -42,7 +42,7 @@ public async Task Schema_property_for_attribute_is_required_for_creating_resourc public async Task Schema_property_for_attribute_is_not_required_for_creating_resource(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => @@ -58,7 +58,7 @@ public async Task Schema_property_for_attribute_is_not_required_for_creating_res public async Task Schema_property_for_relationship_is_required_for_creating_resource(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => @@ -74,7 +74,7 @@ public async Task Schema_property_for_relationship_is_required_for_creating_reso public async Task Schema_property_for_relationship_is_not_required_for_creating_resource(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => @@ -88,7 +88,7 @@ public async Task Schema_property_for_relationship_is_not_required_for_creating_ public async Task No_attribute_schema_properties_are_required_for_updating_resource() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInUpdateResourceRequest.allOf[1]").With(attributesSchema => @@ -101,7 +101,7 @@ public async Task No_attribute_schema_properties_are_required_for_updating_resou public async Task No_relationship_schema_properties_are_required_for_updating_resource() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInUpdateResourceRequest.allOf[1]").With(relationshipsSchema => diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/NullabilityTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/NullabilityTests.cs index 32c9e93779..342f84848f 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/NullabilityTests.cs +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/NullabilityTests.cs @@ -17,7 +17,7 @@ public NullabilityTests(OpenApiTestContext, NrtO testContext.UseController(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; } [Theory] @@ -26,7 +26,7 @@ public NullabilityTests(OpenApiTestContext, NrtO public async Task Schema_property_for_attribute_is_nullable(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => @@ -46,7 +46,7 @@ public async Task Schema_property_for_attribute_is_nullable(string jsonPropertyN public async Task Schema_property_for_attribute_is_not_nullable(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => @@ -63,7 +63,7 @@ public async Task Schema_property_for_attribute_is_not_nullable(string jsonPrope public async Task Schema_property_for_relationship_is_nullable(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => @@ -85,7 +85,7 @@ public async Task Schema_property_for_relationship_is_nullable(string jsonProper public async Task Schema_property_for_relationship_is_not_nullable(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/RequiredTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/RequiredTests.cs index 46a45ac2fd..432d3b8fc4 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/RequiredTests.cs +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/RequiredTests.cs @@ -24,7 +24,7 @@ public RequiredTests(OpenApiTestContext, NrtOffD public async Task Schema_property_for_attribute_is_required_for_creating_resource(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => @@ -42,7 +42,7 @@ public async Task Schema_property_for_attribute_is_required_for_creating_resourc public async Task Schema_property_for_attribute_is_not_required_for_creating_resource(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => @@ -57,7 +57,7 @@ public async Task Schema_property_for_attribute_is_not_required_for_creating_res public async Task Schema_property_for_relationship_is_required_for_creating_resource(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => @@ -74,7 +74,7 @@ public async Task Schema_property_for_relationship_is_required_for_creating_reso public async Task Schema_property_for_relationship_is_not_required_for_creating_resource(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => @@ -88,7 +88,7 @@ public async Task Schema_property_for_relationship_is_not_required_for_creating_ public async Task No_attribute_schema_properties_are_required_for_updating_resource() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInUpdateResourceRequest.allOf[1]").With(attributesSchema => @@ -101,7 +101,7 @@ public async Task No_attribute_schema_properties_are_required_for_updating_resou public async Task No_relationship_schema_properties_are_required_for_updating_resource() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInUpdateResourceRequest.allOf[1]").With(relationshipsSchema => diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/NullabilityTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/NullabilityTests.cs index 084cb85fde..e05118a9de 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/NullabilityTests.cs +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/NullabilityTests.cs @@ -17,7 +17,7 @@ public NullabilityTests(OpenApiTestContext, NrtOnD testContext.UseController(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; } [Theory] @@ -28,7 +28,7 @@ public NullabilityTests(OpenApiTestContext, NrtOnD public async Task Schema_property_for_attribute_is_nullable(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => @@ -48,7 +48,7 @@ public async Task Schema_property_for_attribute_is_nullable(string jsonPropertyN public async Task Schema_property_for_attribute_is_not_nullable(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => @@ -66,7 +66,7 @@ public async Task Schema_property_for_attribute_is_not_nullable(string jsonPrope public async Task Schema_property_for_relationship_is_nullable(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => @@ -89,7 +89,7 @@ public async Task Schema_property_for_relationship_is_nullable(string jsonProper public async Task Schema_property_for_relationship_is_not_nullable(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/RequiredTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/RequiredTests.cs index 64ee1c433e..59d43ae018 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/RequiredTests.cs +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/RequiredTests.cs @@ -26,7 +26,7 @@ public RequiredTests(OpenApiTestContext, NrtOnDbCo public async Task Schema_property_for_attribute_is_required_for_creating_resource(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => @@ -44,7 +44,7 @@ public async Task Schema_property_for_attribute_is_required_for_creating_resourc public async Task Schema_property_for_attribute_is_not_required_for_creating_resource(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => @@ -61,7 +61,7 @@ public async Task Schema_property_for_attribute_is_not_required_for_creating_res public async Task Schema_property_for_relationship_is_required_for_creating_resource(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => @@ -78,7 +78,7 @@ public async Task Schema_property_for_relationship_is_required_for_creating_reso public async Task Schema_property_for_relationship_is_not_required_for_creating_resource(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => @@ -92,7 +92,7 @@ public async Task Schema_property_for_relationship_is_not_required_for_creating_ public async Task No_attribute_schema_properties_are_required_for_updating_resource() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInUpdateResourceRequest.allOf[1]").With(attributesSchema => @@ -105,7 +105,7 @@ public async Task No_attribute_schema_properties_are_required_for_updating_resou public async Task No_relationship_schema_properties_are_required_for_updating_resource() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInUpdateResourceRequest.allOf[1]").With(relationshipsSchema => diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/NullabilityTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/NullabilityTests.cs index 8617f3cd28..11df1144ab 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/NullabilityTests.cs +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/NullabilityTests.cs @@ -17,7 +17,7 @@ public NullabilityTests(OpenApiTestContext, NrtOn testContext.UseController(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; } [Theory] @@ -26,7 +26,7 @@ public NullabilityTests(OpenApiTestContext, NrtOn public async Task Schema_property_for_attribute_is_nullable(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => @@ -48,7 +48,7 @@ public async Task Schema_property_for_attribute_is_nullable(string jsonPropertyN public async Task Schema_property_for_attribute_is_not_nullable(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => @@ -65,7 +65,7 @@ public async Task Schema_property_for_attribute_is_not_nullable(string jsonPrope public async Task Schema_property_for_relationship_is_nullable(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => @@ -89,7 +89,7 @@ public async Task Schema_property_for_relationship_is_nullable(string jsonProper public async Task Schema_property_for_relationship_is_not_nullable(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/RequiredTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/RequiredTests.cs index ad70bcfdeb..8330a6d7c8 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/RequiredTests.cs +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/RequiredTests.cs @@ -26,7 +26,7 @@ public RequiredTests(OpenApiTestContext, NrtOnDbC public async Task Schema_property_for_attribute_is_required_for_creating_resource(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => @@ -44,7 +44,7 @@ public async Task Schema_property_for_attribute_is_required_for_creating_resourc public async Task Schema_property_for_attribute_is_not_required_for_creating_resource(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => @@ -61,7 +61,7 @@ public async Task Schema_property_for_attribute_is_not_required_for_creating_res public async Task Schema_property_for_relationship_is_required_for_creating_resource(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => @@ -78,7 +78,7 @@ public async Task Schema_property_for_relationship_is_required_for_creating_reso public async Task Schema_property_for_relationship_is_not_required_for_creating_resource(string jsonPropertyName) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => @@ -92,7 +92,7 @@ public async Task Schema_property_for_relationship_is_not_required_for_creating_ public async Task No_attribute_schema_properties_are_required_for_updating_resource() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.attributesInUpdateResourceRequest.allOf[1]").With(attributesSchema => @@ -105,7 +105,7 @@ public async Task No_attribute_schema_properties_are_required_for_updating_resou public async Task No_relationship_schema_properties_are_required_for_updating_resource() { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert document.Should().ContainPath("components.schemas.relationshipsInUpdateResourceRequest.allOf[1]").With(relationshipsSchema => diff --git a/test/OpenApiTests/ResourceInheritance/ConcurrencyTests.cs b/test/OpenApiTests/ResourceInheritance/ConcurrencyTests.cs index b7a7ce8e29..15aec9b737 100644 --- a/test/OpenApiTests/ResourceInheritance/ConcurrencyTests.cs +++ b/test/OpenApiTests/ResourceInheritance/ConcurrencyTests.cs @@ -28,7 +28,7 @@ public async Task Can_download_OpenAPI_documents_in_parallel() for (int index = 0; index < count; index++) { - downloadTasks[index] = _testContext.CreateSwaggerDocumentAsync(); + downloadTasks[index] = _testContext.CreateOpenApiDocumentAsync(); } // Act diff --git a/test/OpenApiTests/ResourceInheritance/NoOperations/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceInheritance/NoOperations/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/ResourceInheritance/NoOperations/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/ResourceInheritance/NoOperations/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/ResourceInheritance/OnlyRelationships/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceInheritance/OnlyRelationships/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/ResourceInheritance/OnlyRelationships/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/ResourceInheritance/OnlyRelationships/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/ResourceInheritance/ResourceInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceTests.cs index 94e101a5f0..b7f7242d49 100644 --- a/test/OpenApiTests/ResourceInheritance/ResourceInheritanceTests.cs +++ b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceTests.cs @@ -24,7 +24,7 @@ protected ResourceInheritanceTests(OpenApiTestContext> endpointToPathMap = JsonPathBuilder.GetEndpointPaths(resourceType); // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string[] pathsExpected = JsonPathBuilder.KnownEndpoints.Where(endpoint => expected.HasFlag(endpoint)) @@ -58,7 +58,7 @@ public virtual async Task Only_expected_endpoints_are_exposed(Type resourceClrTy public virtual async Task Operations_endpoint_is_exposed(bool enabled) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert if (enabled) @@ -74,7 +74,7 @@ public virtual async Task Operations_endpoint_is_exposed(bool enabled) public virtual async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert if (discriminatorValues == null) @@ -116,7 +116,7 @@ public virtual async Task Expected_names_appear_in_type_discriminator_mapping(st public virtual async Task Expected_names_appear_in_openapi_discriminator_mapping(string prefixedSchemaName, string? discriminatorValues) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); string schemaName = prefixedSchemaName.StartsWith('!') ? prefixedSchemaName[1..] : prefixedSchemaName; string discriminatorPath = prefixedSchemaName.StartsWith('!') ? "allOf[1].discriminator" : "discriminator"; @@ -159,7 +159,7 @@ public virtual async Task Expected_names_appear_in_openapi_discriminator_mapping public virtual async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert if (enumValues == null) @@ -194,7 +194,7 @@ public virtual async Task Expected_names_appear_in_resource_type_enum(string sch public virtual async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) { // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert if (baseType == null && properties == null) diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/ResourceInheritance/SubsetOfOperations/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/ResourceInheritance/SubsetOfOperations/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/ResourceInheritance/SubsetOfVarious/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/ResourceInheritance/SubsetOfVarious/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/net10.0/swagger.g.json similarity index 100% rename from test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json rename to test/OpenApiTests/RestrictedControllers/GeneratedSwagger/net10.0/swagger.g.json diff --git a/test/OpenApiTests/RestrictedControllers/RestrictionTests.cs b/test/OpenApiTests/RestrictedControllers/RestrictionTests.cs index 061b6b4733..d1d66e00b4 100644 --- a/test/OpenApiTests/RestrictedControllers/RestrictionTests.cs +++ b/test/OpenApiTests/RestrictedControllers/RestrictionTests.cs @@ -24,7 +24,7 @@ public RestrictionTests(OpenApiTestContext, testContext.UseController(); testContext.SetTestOutputHelper(testOutputHelper); - testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + testContext.OpenApiDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; } [Theory] @@ -41,7 +41,7 @@ public async Task Only_expected_endpoints_are_exposed(Type resourceClrType, Json IReadOnlyDictionary> endpointToPathMap = JsonPathBuilder.GetEndpointPaths(resourceType); // Act - JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + JsonElement document = await _testContext.GetOpenApiDocumentAsync(); // Assert string[] pathsExpected = JsonPathBuilder.KnownEndpoints.Where(endpoint => expected.HasFlag(endpoint)) diff --git a/test/TestBuildingBlocks/IntegrationTestContext.cs b/test/TestBuildingBlocks/IntegrationTestContext.cs index 4876388c3a..36672cb3b3 100644 --- a/test/TestBuildingBlocks/IntegrationTestContext.cs +++ b/test/TestBuildingBlocks/IntegrationTestContext.cs @@ -76,7 +76,7 @@ private WebApplicationFactory CreateFactory() { _configureServices?.Invoke(services); - services.Replace(ServiceDescriptor.Singleton(new FrozenTimeProvider(DefaultDateTimeUtc))); + services.TryAddSingleton(new FrozenTimeProvider(DefaultDateTimeUtc)); services.ReplaceControllers(_testControllerProvider);