Skip to content

Commit d16dbd7

Browse files
Fix tests
Fix tests due to error in test setup fixture caused by changes in microsoft/OpenAPI.NET#2325.
1 parent 2645264 commit d16dbd7

8 files changed

+19
-31
lines changed

test/Swashbuckle.AspNetCore.IntegrationTests/snapshots/VerifyTests.SwaggerEndpoint_ReturnsValidSwaggerJson_startupType=TestFirst.Startup_swaggerRequestUri=v1-generated.DotNet10_0.verified.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
"paths": {
88
"/api/users": {
99
"post": {
10-
"tags": [
11-
"Users"
12-
],
1310
"operationId": "CreateUser",
1411
"requestBody": {
1512
"content": {

test/Swashbuckle.AspNetCore.IntegrationTests/snapshots/VerifyTests.SwaggerEndpoint_ReturnsValidSwaggerJson_startupType=TestFirst.Startup_swaggerRequestUri=v1-generated.DotNet8_0.verified.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
"paths": {
88
"/api/users": {
99
"post": {
10-
"tags": [
11-
"Users"
12-
],
1310
"operationId": "CreateUser",
1411
"requestBody": {
1512
"content": {

test/Swashbuckle.AspNetCore.IntegrationTests/snapshots/VerifyTests.SwaggerEndpoint_ReturnsValidSwaggerJson_startupType=TestFirst.Startup_swaggerRequestUri=v1-generated.DotNet9_0.verified.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
"paths": {
88
"/api/users": {
99
"post": {
10-
"tags": [
11-
"Users"
12-
],
1310
"operationId": "CreateUser",
1411
"requestBody": {
1512
"content": {

test/WebSites/TestFirst.IntegrationTests/CreateProductTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
namespace TestFirst.IntegrationTests;
88

9-
public class CreateProductTests(ApiTestRunner apiTestRunner, WebApplicationFactory<TestFirst.Startup> webApplicationFactory)
10-
: ApiTestFixture<TestFirst.Startup>(apiTestRunner, webApplicationFactory, "v1-imported")
9+
public class CreateProductTests(ApiTestRunner apiTestRunner, WebApplicationFactory<Startup> webApplicationFactory)
10+
: ApiTestFixture<Startup>(apiTestRunner, webApplicationFactory, "v1-imported")
1111
{
12-
[Fact(Skip = "Disabled due to issue with truncated OpenAPI document")]
12+
[Fact]
1313
public async Task CreateProduct_Returns201_IfContentIsValid()
1414
{
1515
await TestAsync(
@@ -27,7 +27,7 @@ await TestAsync(
2727
);
2828
}
2929

30-
[Fact(Skip = "Disabled due to issue with truncated OpenAPI document")]
30+
[Fact]
3131
public async Task CreateProduct_Returns400_IfContentIsInValid()
3232
{
3333
await TestAsync(

test/WebSites/TestFirst.IntegrationTests/CreateUserTests.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
using Microsoft.AspNetCore.Mvc.Testing;
33
using Microsoft.OpenApi.Models;
44
using Microsoft.OpenApi.Models.Interfaces;
5-
using Microsoft.OpenApi.Models.References;
65
using Newtonsoft.Json;
76
using Swashbuckle.AspNetCore;
87
using Swashbuckle.AspNetCore.ApiTesting.Xunit;
98
using Xunit;
109

1110
namespace TestFirst.IntegrationTests;
1211

13-
public class CreateUserTests : ApiTestFixture<TestFirst.Startup>
12+
public class CreateUserTests : ApiTestFixture<Startup>
1413
{
1514
public CreateUserTests(
1615
ApiTestRunner apiTestRunner,
@@ -20,7 +19,6 @@ public CreateUserTests(
2019
Describe("/api/users", HttpMethod.Post, new OpenApiOperation
2120
{
2221
OperationId = "CreateUser",
23-
Tags = [new OpenApiTagReference("Users")],
2422
RequestBody = new OpenApiRequestBody
2523
{
2624
Content = new Dictionary<string, OpenApiMediaType>
@@ -63,7 +61,7 @@ public CreateUserTests(
6361
});
6462
}
6563

66-
[Fact(Skip = "Disabled due to issue with truncated OpenAPI document")]
64+
[Fact]
6765
public async Task CreateUser_Returns201_IfContentIsValid()
6866
{
6967
await TestAsync(
@@ -81,7 +79,7 @@ await TestAsync(
8179
);
8280
}
8381

84-
[Fact(Skip = "Disabled due to issue with truncated OpenAPI document")]
82+
[Fact]
8583
public async Task CreateUser_Returns400_IfContentIsInValid()
8684
{
8785
await TestAsync(

test/WebSites/TestFirst.IntegrationTests/GetProductsTests.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@
44

55
namespace TestFirst.IntegrationTests;
66

7-
public class GetProductsTests : ApiTestFixture<TestFirst.Startup>
7+
public class GetProductsTests(ApiTestRunner apiTestRunner, WebApplicationFactory<Startup> webApplicationFactory)
8+
: ApiTestFixture<Startup>(apiTestRunner, webApplicationFactory, "v1-imported")
89
{
9-
public GetProductsTests(
10-
ApiTestRunner apiTestRunner,
11-
WebApplicationFactory<TestFirst.Startup> webApplicationFactory)
12-
: base(apiTestRunner, webApplicationFactory, "v1-imported")
13-
{ }
1410

15-
[Fact(Skip = "Disabled due to issue with truncated OpenAPI document")]
16-
public async Task GetProducsts_Returns200_IfRequiredParametersProvided()
11+
[Fact]
12+
public async Task GetProducts_Returns200_IfRequiredParametersProvided()
1713
{
1814
await TestAsync(
1915
"GetProducts",
@@ -26,7 +22,7 @@ await TestAsync(
2622
);
2723
}
2824

29-
[Fact(Skip = "Disabled due to issue with truncated OpenAPI document")]
25+
[Fact]
3026
public async Task GetProducts_Returns400_IfRequiredParametersMissing()
3127
{
3228
await TestAsync(

test/WebSites/TestFirst/wwwroot/swagger/v1-generated/openapi.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
"paths": {
88
"/api/users": {
99
"post": {
10-
"tags": [
11-
"Users"
12-
],
1310
"operationId": "CreateUser",
1411
"requestBody": {
1512
"content": {

test/WebSites/TestFirst/wwwroot/swagger/v1-imported/openapi.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,11 @@
123123
}
124124
}
125125
}
126-
}
126+
},
127+
"tags": [
128+
{
129+
"name": "Products",
130+
"description": "Operations about products"
131+
}
132+
]
127133
}

0 commit comments

Comments
 (0)