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
Add test coverage for some APIs
  • Loading branch information
lahma committed Aug 9, 2025
commit 27e32dff9ee881ad916ee92245c589c2a09ea2cf
21 changes: 18 additions & 3 deletions src/NSwag.CodeGeneration.CSharp.Tests/ClientGenerationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,22 @@ public class ClientGenerationTests
[Fact]
public async Task CanGenerateFromJiraOpenApiSpecification()
{
await VerifyOutput("JIRA_OpenAPI", "jira-open-api.json");
await VerifyOutput("JIRA_OpenAPI", "jira-open-api.json", compile: false);
}

private static async Task VerifyOutput(string name, string fileName)
[Fact]
public async Task CanGenerateFromShipBobOpenApiSpecification()
{
await VerifyOutput("ShipBob_OpenAPI", "shipbob-2025-07.json");
}

[Fact]
public async Task CanGenerateFromNhsSpineServicesOpenApiSpecification()
{
await VerifyOutput("NHS_SpineServices_OpenAPI", "nhs-spineservices.json");
}

private static async Task VerifyOutput(string name, string fileName, bool compile = true)
{
var specification = await File.ReadAllTextAsync(Path.Combine("TestData", fileName));

Expand All @@ -27,6 +39,9 @@ await VerifyHelper
.Verify(code, scrubApiComments: false)
.UseFileName(name);

// TODO CodeCompiler.AssertCompile(code);
if (compile)
{
CSharpCompiler.AssertCompile(code);
}
}
}
Loading
Loading