Skip to content

Commit f8bcb7d

Browse files
Move snapshots (#3314)
Move all snapshots to their own directory and rename some of the tests to shorten the file names to avoid `MAX_PATH` issues on Windows.
1 parent ecbb87f commit f8bcb7d

144 files changed

Lines changed: 105 additions & 124 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

test/Swashbuckle.AspNetCore.IntegrationTests/SwaggerVerifyIntegrationTest.cs renamed to test/Swashbuckle.AspNetCore.IntegrationTests/VerifyTests.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace Swashbuckle.AspNetCore.IntegrationTests
1010
{
1111
[Collection("TestSite")]
12-
public partial class SwaggerVerifyIntegrationTest
12+
public partial class VerifyTests
1313
{
1414
[Theory]
1515
[InlineData(typeof(Basic.Startup), "/swagger/v1/swagger.json")]
@@ -36,6 +36,7 @@ public async Task SwaggerEndpoint_ReturnsValidSwaggerJson(
3636
var swagger = await swaggerResponse.Content.ReadAsStringAsync();
3737

3838
await Verifier.Verify(NormalizeLineBreaks(swagger))
39+
.UseDirectory("snapshots")
3940
.UseParameters(startupType, GetVersion(swaggerRequestUri))
4041
.UniqueForTargetFrameworkAndVersion();
4142
}
@@ -51,7 +52,9 @@ public async Task SwaggerEndpoint_ReturnsValidSwaggerJson_ForAutofaq()
5152

5253
using var swaggerResponse = await client.GetAsync(swaggerRequestUri);
5354
var swagger = await swaggerResponse.Content.ReadAsStringAsync();
55+
5456
await Verifier.Verify(swagger)
57+
.UseDirectory("snapshots")
5558
.UseParameters(startupType, GetVersion(swaggerRequestUri))
5659
.UniqueForTargetFrameworkAndVersion();
5760
}
@@ -67,7 +70,9 @@ public async Task Swagger_IsValidJson_No_Startup(
6770
string swaggerRequestUri)
6871
{
6972
var swaggerResponse = await SwaggerEndpointReturnsValidSwaggerJson(entryPointType, swaggerRequestUri);
73+
7074
await Verifier.Verify(swaggerResponse)
75+
.UseDirectory("snapshots")
7176
.UseParameters(entryPointType, GetVersion(swaggerRequestUri))
7277
.UniqueForTargetFrameworkAndVersion();
7378
}
@@ -79,7 +84,9 @@ public async Task TypesAreRenderedCorrectly()
7984
using var client = application.CreateDefaultClient();
8085

8186
var swaggerResponse = await SwaggerResponse(client, "/swagger/v1/swagger.json");
87+
8288
await Verifier.Verify(swaggerResponse)
89+
.UseDirectory("snapshots")
8390
.UniqueForTargetFrameworkAndVersion();
8491
}
8592

@@ -100,9 +107,7 @@ private static async Task<string> SwaggerResponse(HttpClient client, string swag
100107
/// Normalize "\n" strings into "\r\n" which is expected linebreak in Verify verified.txt files.
101108
/// </summary>
102109
private static string NormalizeLineBreaks(string swagger)
103-
{
104-
return UnixNewLineRegex().Replace(swagger, "\\r\\n");
105-
}
110+
=> UnixNewLineRegex().Replace(swagger, "\\r\\n");
106111

107112
private static string GetVersion(string swaggerUi) =>
108113
VersionRegex().Match(swaggerUi).Groups[1].Value;

test/Swashbuckle.AspNetCore.IntegrationTests/SwaggerVerifyIntegrationTest.SwaggerEndpoint_ReturnsValidSwaggerJson_ForAutofaq.DotNet8_0.verified.txt renamed to test/Swashbuckle.AspNetCore.IntegrationTests/snapshots/VerifyTests.SwaggerEndpoint_ReturnsValidSwaggerJson_ForAutofaq.DotNet8_0.verified.txt

File renamed without changes.

test/Swashbuckle.AspNetCore.IntegrationTests/SwaggerVerifyIntegrationTest.SwaggerEndpoint_ReturnsValidSwaggerJson_ForAutofaq.DotNet9_0.verified.txt renamed to test/Swashbuckle.AspNetCore.IntegrationTests/snapshots/VerifyTests.SwaggerEndpoint_ReturnsValidSwaggerJson_ForAutofaq.DotNet9_0.verified.txt

File renamed without changes.

test/Swashbuckle.AspNetCore.IntegrationTests/SwaggerVerifyIntegrationTest.SwaggerEndpoint_ReturnsValidSwaggerJson_startupType=Basic.Startup_swaggerRequestUri=v1.DotNet8_0.verified.txt renamed to test/Swashbuckle.AspNetCore.IntegrationTests/snapshots/VerifyTests.SwaggerEndpoint_ReturnsValidSwaggerJson_startupType=Basic.Startup_swaggerRequestUri=v1.DotNet8_0.verified.txt

File renamed without changes.

test/Swashbuckle.AspNetCore.IntegrationTests/SwaggerVerifyIntegrationTest.SwaggerEndpoint_ReturnsValidSwaggerJson_startupType=Basic.Startup_swaggerRequestUri=v1.DotNet9_0.verified.txt renamed to test/Swashbuckle.AspNetCore.IntegrationTests/snapshots/VerifyTests.SwaggerEndpoint_ReturnsValidSwaggerJson_startupType=Basic.Startup_swaggerRequestUri=v1.DotNet9_0.verified.txt

File renamed without changes.

test/Swashbuckle.AspNetCore.IntegrationTests/SwaggerVerifyIntegrationTest.SwaggerEndpoint_ReturnsValidSwaggerJson_startupType=CliExample.Startup_swaggerRequestUri=v1.DotNet8_0.verified.txt renamed to test/Swashbuckle.AspNetCore.IntegrationTests/snapshots/VerifyTests.SwaggerEndpoint_ReturnsValidSwaggerJson_startupType=CliExample.Startup_swaggerRequestUri=v1.DotNet8_0.verified.txt

File renamed without changes.

test/Swashbuckle.AspNetCore.IntegrationTests/SwaggerVerifyIntegrationTest.SwaggerEndpoint_ReturnsValidSwaggerJson_startupType=CliExample.Startup_swaggerRequestUri=v1.DotNet9_0.verified.txt renamed to test/Swashbuckle.AspNetCore.IntegrationTests/snapshots/VerifyTests.SwaggerEndpoint_ReturnsValidSwaggerJson_startupType=CliExample.Startup_swaggerRequestUri=v1.DotNet9_0.verified.txt

File renamed without changes.

test/Swashbuckle.AspNetCore.IntegrationTests/SwaggerVerifyIntegrationTest.SwaggerEndpoint_ReturnsValidSwaggerJson_startupType=ConfigFromFile.Startup_swaggerRequestUri=v1.DotNet8_0.verified.txt renamed to test/Swashbuckle.AspNetCore.IntegrationTests/snapshots/VerifyTests.SwaggerEndpoint_ReturnsValidSwaggerJson_startupType=ConfigFromFile.Startup_swaggerRequestUri=v1.DotNet8_0.verified.txt

File renamed without changes.

test/Swashbuckle.AspNetCore.IntegrationTests/SwaggerVerifyIntegrationTest.SwaggerEndpoint_ReturnsValidSwaggerJson_startupType=ConfigFromFile.Startup_swaggerRequestUri=v1.DotNet9_0.verified.txt renamed to test/Swashbuckle.AspNetCore.IntegrationTests/snapshots/VerifyTests.SwaggerEndpoint_ReturnsValidSwaggerJson_startupType=ConfigFromFile.Startup_swaggerRequestUri=v1.DotNet9_0.verified.txt

File renamed without changes.

test/Swashbuckle.AspNetCore.IntegrationTests/SwaggerVerifyIntegrationTest.SwaggerEndpoint_ReturnsValidSwaggerJson_startupType=CustomDocumentSerializer.Startup_swaggerRequestUri=v1.DotNet8_0.verified.txt renamed to test/Swashbuckle.AspNetCore.IntegrationTests/snapshots/VerifyTests.SwaggerEndpoint_ReturnsValidSwaggerJson_startupType=CustomDocumentSerializer.Startup_swaggerRequestUri=v1.DotNet8_0.verified.txt

File renamed without changes.

0 commit comments

Comments
 (0)