Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<_UniquePackageNames>@(_UniquePackageNames->'%(Identity)', ',')</_UniquePackageNames>
</PropertyGroup>
<WriteLinesToFile File="$(_PackageNamesPath)" Lines="@(_UniquePackageNames)" Overwrite="true" WriteOnlyWhenDifferent="true" />
<WriteLinesToFile File="$(GITHUB_OUTPUT)" Lines="package-names=$(_UniquePackageNames)" />
<WriteLinesToFile File="$(GITHUB_OUTPUT)" Lines="package-version=$(Version)" />
<WriteLinesToFileWithRetry File="$(GITHUB_OUTPUT)" Lines="package-names=$(_UniquePackageNames)" />
<WriteLinesToFileWithRetry File="$(GITHUB_OUTPUT)" Lines="package-version=$(Version)" />
</Target>
</Project>
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<PackageVersion Include="IdentityServer4" Version="3.1.4" />
<PackageVersion Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />
<PackageVersion Include="JunitXml.TestLogger" Version="6.1.0" />
<PackageVersion Include="MartinCostello.Logging.XUnit.v3" Version="0.6.0" />
<PackageVersion Include="Microsoft.AspNetCore" Version="2.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.ApiExplorer" Version="2.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.DataAnnotations" Version="2.3.0" />
Expand Down
1 change: 1 addition & 0 deletions Swashbuckle.AspNetCore.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<File Path="Directory.Build.props" />
<File Path="Directory.Build.targets" />
<File Path="Directory.Packages.props" />
<File Path="exclusion.dic" />
<File Path="global.json" />
<File Path="ISSUE_TEMPLATE.md" />
<File Path="LICENSE" />
Expand Down
1 change: 1 addition & 0 deletions exclusion.dic
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ Newtonsoft
NuGet
Redoc
serializer
startup
swashbuckle
swagger-ui
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
namespace Swashbuckle.AspNetCore.IntegrationTests;

[Collection("TestSite")]
public class CustomDocumentSerializerTests
public class CustomDocumentSerializerTests(ITestOutputHelper outputHelper)
{
[Fact]
public async Task TestSite_Writes_Custom_V3_Document()
{
var testSite = new TestSite(typeof(CustomDocumentSerializer.Startup));
var testSite = new TestSite(typeof(CustomDocumentSerializer.Startup), outputHelper);
var client = testSite.BuildClient();

var swaggerResponse = await client.GetAsync($"/swagger/v1/swagger.json", TestContext.Current.CancellationToken);
Expand All @@ -30,7 +30,7 @@ public async Task TestSite_Writes_Custom_V3_Document()
[Fact]
public async Task TestSite_Writes_Custom_V2_Document()
{
var testSite = new TestSite(typeof(CustomDocumentSerializer.Startup));
var testSite = new TestSite(typeof(CustomDocumentSerializer.Startup), outputHelper);
var client = testSite.BuildClient();

var swaggerResponse = await client.GetAsync($"/swagger/v1/swaggerv2.json", TestContext.Current.CancellationToken);
Expand All @@ -47,7 +47,7 @@ public async Task TestSite_Writes_Custom_V2_Document()
[Fact]
public async Task DocumentProvider_Writes_Custom_V3_Document()
{
var testSite = new TestSite(typeof(CustomDocumentSerializer.Startup));
var testSite = new TestSite(typeof(CustomDocumentSerializer.Startup), outputHelper);
var server = testSite.BuildServer();
var services = server.Host.Services;

Expand Down Expand Up @@ -81,9 +81,9 @@ await DocumentProviderWritesCustomV2Document(
public async Task DocumentProvider_Writes_Custom_V2_Document_SerializeAsV2()
=> await DocumentProviderWritesCustomV2Document((options) => options.SerializeAsV2 = true);

private static async Task DocumentProviderWritesCustomV2Document(Action<SwaggerOptions> configure)
private async Task DocumentProviderWritesCustomV2Document(Action<SwaggerOptions> configure)
{
var testSite = new TestSite(typeof(CustomDocumentSerializer.Startup));
var testSite = new TestSite(typeof(CustomDocumentSerializer.Startup), outputHelper);
var server = testSite.BuildServer();
var services = server.Host.Services;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Swashbuckle.AspNetCore.IntegrationTests;

[Collection("TestSite")]
public class DocumentProviderTests
public class DocumentProviderTests(ITestOutputHelper outputHelper)
{
[Theory]
[InlineData(typeof(Basic.Startup), new[] { "v1" })]
Expand All @@ -16,7 +16,7 @@ public class DocumentProviderTests
[InlineData(typeof(OAuth2Integration.Startup), new[] { "v1" })]
public void DocumentProvider_ExposesAllDocumentNames(Type startupType, string[] expectedNames)
{
var testSite = new TestSite(startupType);
var testSite = new TestSite(startupType, outputHelper);
var server = testSite.BuildServer();
var services = server.Host.Services;
var documentProvider = (IDocumentProvider)services.GetService(typeof(IDocumentProvider));
Expand All @@ -35,7 +35,7 @@ public void DocumentProvider_ExposesAllDocumentNames(Type startupType, string[]
[InlineData(typeof(OAuth2Integration.Startup), "v1")]
public async Task DocumentProvider_ExposesGeneratedSwagger(Type startupType, string documentName)
{
var testSite = new TestSite(startupType);
var testSite = new TestSite(startupType, outputHelper);
var server = testSite.BuildServer();
var services = server.Host.Services;

Expand All @@ -56,7 +56,7 @@ public async Task DocumentProvider_ExposesGeneratedSwagger(Type startupType, str
[Fact]
public async Task DocumentProvider_ThrowsUnknownDocument_IfUnknownDocumentName()
{
var testSite = new TestSite(typeof(Basic.Startup));
var testSite = new TestSite(typeof(Basic.Startup), outputHelper);
var server = testSite.BuildServer();
var services = server.Host.Services;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
namespace Swashbuckle.AspNetCore.IntegrationTests;

[Collection("TestSite")]
public class ReDocIntegrationTests
public class ReDocIntegrationTests(ITestOutputHelper outputHelper)
{
[Fact]
public async Task RoutePrefix_RedirectsToIndexUrl()
{
var site = new TestSite(typeof(ReDocApp.Startup));
var site = new TestSite(typeof(ReDocApp.Startup), outputHelper);
using var client = site.BuildClient();

using var response = await client.GetAsync("/api-docs", TestContext.Current.CancellationToken);
Expand All @@ -23,7 +23,7 @@ public async Task RoutePrefix_RedirectsToIndexUrl()
[Fact]
public async Task IndexUrl_ReturnsEmbeddedVersionOfTheRedocUI()
{
var site = new TestSite(typeof(ReDocApp.Startup));
var site = new TestSite(typeof(ReDocApp.Startup), outputHelper);
using var client = site.BuildClient();

using var htmlResponse = await client.GetAsync("/api-docs/index.html", TestContext.Current.CancellationToken);
Expand All @@ -49,7 +49,7 @@ static void AssertResource(HttpResponseMessage response)
[Fact]
public async Task RedocMiddleware_ReturnsInitializerScript()
{
var site = new TestSite(typeof(ReDocApp.Startup));
var site = new TestSite(typeof(ReDocApp.Startup), outputHelper);
using var client = site.BuildClient();

using var response = await client.GetAsync("/api-docs/index.js", TestContext.Current.CancellationToken);
Expand All @@ -66,7 +66,7 @@ public async Task RedocMiddleware_ReturnsInitializerScript()
[Fact]
public async Task IndexUrl_IgnoresUrlCase()
{
var site = new TestSite(typeof(ReDocApp.Startup));
var site = new TestSite(typeof(ReDocApp.Startup), outputHelper);
using var client = site.BuildClient();

using var htmlResponse = await client.GetAsync("/Api-Docs/index.html", TestContext.Current.CancellationToken);
Expand All @@ -85,7 +85,7 @@ public async Task IndexUrl_IgnoresUrlCase()
[InlineData("/redoc/2.0/index.html", "/redoc/2.0/index.js", "/swagger/2.0/swagger.json")]
public async Task RedocMiddleware_CanBeConfiguredMultipleTimes(string htmlUrl, string jsUrl, string swaggerPath)
{
var site = new TestSite(typeof(MultipleVersions.Startup));
var site = new TestSite(typeof(MultipleVersions.Startup), outputHelper);
using var client = site.BuildClient();

using var htmlResponse = await client.GetAsync(htmlUrl, TestContext.Current.CancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Swashbuckle.AspNetCore.IntegrationTests;

[Collection("TestSite")]
public class SwaggerIntegrationTests
public class SwaggerIntegrationTests(ITestOutputHelper outputHelper)
{
[Theory]
[InlineData(typeof(Basic.Startup), "/swagger/v1/swagger.json")]
Expand All @@ -27,7 +27,7 @@ public async Task SwaggerEndpoint_ReturnsValidSwaggerJson(
Type startupType,
string swaggerRequestUri)
{
var testSite = new TestSite(startupType);
var testSite = new TestSite(startupType, outputHelper);
using var client = testSite.BuildClient();

await AssertValidSwaggerJson(client, swaggerRequestUri);
Expand All @@ -45,7 +45,7 @@ public async Task SwaggerEndpoint_ReturnsValidSwaggerJson_ForAutofaq()
[Fact]
public async Task SwaggerEndpoint_ReturnsNotFound_IfUnknownSwaggerDocument()
{
var testSite = new TestSite(typeof(Basic.Startup));
var testSite = new TestSite(typeof(Basic.Startup), outputHelper);
using var client = testSite.BuildClient();

using var swaggerResponse = await client.GetAsync("/swagger/v2/swagger.json", TestContext.Current.CancellationToken);
Expand All @@ -56,7 +56,7 @@ public async Task SwaggerEndpoint_ReturnsNotFound_IfUnknownSwaggerDocument()
[Fact]
public async Task SwaggerEndpoint_DoesNotReturnByteOrderMark()
{
var testSite = new TestSite(typeof(Basic.Startup));
var testSite = new TestSite(typeof(Basic.Startup), outputHelper);
using var client = testSite.BuildClient();

using var swaggerResponse = await client.GetAsync("/swagger/v1/swagger.json", TestContext.Current.CancellationToken);
Expand All @@ -72,7 +72,7 @@ public async Task SwaggerEndpoint_DoesNotReturnByteOrderMark()
[InlineData("sv-SE")]
public async Task SwaggerEndpoint_ReturnsCorrectPriceExample_ForDifferentCultures(string culture)
{
var testSite = new TestSite(typeof(Basic.Startup));
var testSite = new TestSite(typeof(Basic.Startup), outputHelper);
using var client = testSite.BuildClient();

using var swaggerResponse = await client.GetAsync($"/swagger/v1/swagger.json?culture={culture}", TestContext.Current.CancellationToken);
Expand Down Expand Up @@ -103,7 +103,7 @@ public async Task SwaggerMiddleware_CanBeConfiguredMultipleTimes(
string expectedVersionProperty,
string expectedVersionValue)
{
using var client = new TestSite(typeof(Basic.Startup)).BuildClient();
using var client = new TestSite(typeof(Basic.Startup), outputHelper).BuildClient();

using var response = await client.GetAsync(swaggerUrl, TestContext.Current.CancellationToken);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Swashbuckle.AspNetCore.IntegrationTests;

[Collection("TestSite")]
public class SwaggerUIIntegrationTests
public class SwaggerUIIntegrationTests(ITestOutputHelper outputHelper)
{
[Theory]
[InlineData(typeof(Basic.Startup), "/", "index.html")]
Expand All @@ -14,7 +14,7 @@ public async Task RoutePrefix_RedirectsToPathRelativeIndexUrl(
string requestPath,
string expectedRedirectPath)
{
var site = new TestSite(startupType);
var site = new TestSite(startupType, outputHelper);
using var client = site.BuildClient();

using var response = await client.GetAsync(requestPath, TestContext.Current.CancellationToken);
Expand All @@ -33,7 +33,7 @@ public async Task IndexUrl_ReturnsEmbeddedVersionOfTheSwaggerUI(
string indexCssPath,
string swaggerUiCssPath)
{
var site = new TestSite(startupType);
var site = new TestSite(startupType, outputHelper);
using var client = site.BuildClient();

using var htmlResponse = await client.GetAsync(htmlPath, TestContext.Current.CancellationToken);
Expand Down Expand Up @@ -67,7 +67,7 @@ public async Task SwaggerUIMiddleware_ReturnsInitializerScript(
Type startupType,
string indexJsPath)
{
var site = new TestSite(startupType);
var site = new TestSite(startupType, outputHelper);
using var client = site.BuildClient();

using var jsResponse = await client.GetAsync(indexJsPath, TestContext.Current.CancellationToken);
Expand All @@ -88,7 +88,7 @@ public async Task SwaggerUIMiddleware_ReturnsInitializerScript(
[Fact]
public async Task IndexUrl_DefinesPlugins()
{
var site = new TestSite(typeof(CustomUIConfig.Startup));
var site = new TestSite(typeof(CustomUIConfig.Startup), outputHelper);
using var client = site.BuildClient();

using var jsResponse = await client.GetAsync("/swagger/index.js", TestContext.Current.CancellationToken);
Expand All @@ -101,7 +101,7 @@ public async Task IndexUrl_DefinesPlugins()
[Fact]
public async Task IndexUrl_DoesntDefinePlugins()
{
var site = new TestSite(typeof(Basic.Startup));
var site = new TestSite(typeof(Basic.Startup), outputHelper);
using var client = site.BuildClient();

using var jsResponse = await client.GetAsync("/index.js", TestContext.Current.CancellationToken);
Expand All @@ -113,7 +113,7 @@ public async Task IndexUrl_DoesntDefinePlugins()
[Fact]
public async Task IndexUrl_ReturnsCustomPageTitleAndStylesheets_IfConfigured()
{
var site = new TestSite(typeof(CustomUIConfig.Startup));
var site = new TestSite(typeof(CustomUIConfig.Startup), outputHelper);
using var client = site.BuildClient();

using var response = await client.GetAsync("/swagger/index.html", TestContext.Current.CancellationToken);
Expand All @@ -126,7 +126,7 @@ public async Task IndexUrl_ReturnsCustomPageTitleAndStylesheets_IfConfigured()
[Fact]
public async Task IndexUrl_ReturnsCustomIndexHtml_IfConfigured()
{
var site = new TestSite(typeof(CustomUIIndex.Startup));
var site = new TestSite(typeof(CustomUIIndex.Startup), outputHelper);
using var client = site.BuildClient();

using var response = await client.GetAsync("/swagger/index.html", TestContext.Current.CancellationToken);
Expand All @@ -138,7 +138,7 @@ public async Task IndexUrl_ReturnsCustomIndexHtml_IfConfigured()
[Fact]
public async Task IndexUrl_ReturnsInterceptors_IfConfigured()
{
var site = new TestSite(typeof(CustomUIConfig.Startup));
var site = new TestSite(typeof(CustomUIConfig.Startup), outputHelper);
using var client = site.BuildClient();

using var response = await client.GetAsync("/swagger/index.js", TestContext.Current.CancellationToken);
Expand All @@ -154,7 +154,7 @@ public async Task IndexUrl_ReturnsInterceptors_IfConfigured()
[InlineData("/swagger/2.0/index.html", "/swagger/2.0/index.js", new[] { "Version 2.0" })]
public async Task SwaggerUIMiddleware_CanBeConfiguredMultipleTimes(string htmlUrl, string jsUrl, string[] versions)
{
var site = new TestSite(typeof(MultipleVersions.Startup));
var site = new TestSite(typeof(MultipleVersions.Startup), outputHelper);
using var client = site.BuildClient();

using var htmlResponse = await client.GetAsync(htmlUrl, TestContext.Current.CancellationToken);
Expand All @@ -179,7 +179,7 @@ public async Task IndexUrl_Returns_ExpectedAssetPaths(
string scriptBundlePath,
string scriptPresetsPath)
{
var site = new TestSite(startupType);
var site = new TestSite(startupType, outputHelper);
using var client = site.BuildClient();

using var htmlResponse = await client.GetAsync(htmlPath, TestContext.Current.CancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MartinCostello.Logging.XUnit.v3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
Expand Down
Loading