-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #283 from yadanilov19/main
Fixed operation name generation names when it has illegal symbols by @yadanilov19
- Loading branch information
Showing
8 changed files
with
1,924 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using FluentAssertions; | ||
|
||
using Refitter.Core; | ||
using Refitter.Tests.Build; | ||
using Refitter.Tests.Resources; | ||
|
||
using Xunit; | ||
|
||
namespace Refitter.Tests; | ||
|
||
public class IllegalSymbolsTests | ||
{ | ||
[Fact] | ||
public async Task Illegal_Symbols_In_Paths__Should_Build_Successfully() | ||
{ | ||
var generateCode = await GenerateCode(EmbeddedResources.SwaggerIllegalPathsJsonV3); | ||
BuildHelper | ||
.BuildCSharp(generateCode) | ||
.Should() | ||
.BeTrue(); | ||
} | ||
|
||
[Fact] | ||
public async Task Illegal_Symbols_In_Title__Should_Build_Successfully() | ||
{ | ||
var generateCode = await GenerateCode(EmbeddedResources.SwaggerIllegalSymbolsInTitleJsonV3); | ||
BuildHelper | ||
.BuildCSharp(generateCode) | ||
.Should() | ||
.BeTrue(); | ||
} | ||
|
||
private static async Task<string> GenerateCode( | ||
string content, | ||
RefitGeneratorSettings? settings = null) | ||
{ | ||
var swaggerFile = await TestFile.CreateSwaggerFile(content, Guid.NewGuid().ToString()); | ||
if (settings is null) | ||
{ | ||
settings = new RefitGeneratorSettings { OpenApiPath = swaggerFile }; | ||
} | ||
else | ||
{ | ||
settings.OpenApiPath = swaggerFile; | ||
} | ||
|
||
var sut = await RefitGenerator.CreateAsync(settings); | ||
|
||
return sut.Generate(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.