Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add snapshot tests using Verify #2929

Merged
merged 8 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,13 @@ trim_trailing_whitespace = true

[*.cs]
dotnet_sort_system_directives_first = true

# Verify settings
[*.{received,verified}.{txt,xml,json}]
charset = "utf-8-bom"
end_of_line = lf
indent_size = unset
indent_style = unset
insert_final_newline = false
tab_width = unset
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Set the default end-of-line to UNIX
* text=auto eol=lf
*.verified.txt text eol=lf working-tree-encoding=UTF-8
*.verified.xml text eol=lf working-tree-encoding=UTF-8
*.verified.json text eol=lf working-tree-encoding=UTF-8
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ test/WebSites/CliExample/wwwroot/api-docs/v1/*.json
test/WebSites/CliExampleWithFactory/wwwroot/api-docs/v1/*.json
test/WebSites/NswagClientExample/NSwagClient/
*ncrunch*
*.received.*
3 changes: 2 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
<PackageVersion Include="Nswag.MSbuild" Version="14.0.7" />
<PackageVersion Include="ReportGenerator" Version="5.2.5" />
<PackageVersion Include="System.Text.Json" Version="4.6.0" />
<PackageVersion Include="Verify.Xunit" Version="24.2.0" />
keahpeters marked this conversation as resolved.
Show resolved Hide resolved
<PackageVersion Include="xunit" Version="2.8.0" />
<PackageVersion Include="xunit.core" Version="2.8.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.0" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
Info: {
Title: Test API,
Version: V1
},
Paths: {
/resource: {
Operations: {
Post: {
Tags: [
{
Name: Fake,
UnresolvedReference: false
}
],
OperationId: SomeEndpointName,
Responses: {
200: {
Description: OK,
UnresolvedReference: false
}
},
Deprecated: false
}
},
UnresolvedReference: false
}
},
Components: {},
HashCode: A0047BEEDFB7C084AF6BF3412F47917E1914849406956B23249FD5A555B9545157FBFF5C1EAFC073B55E59FDE9BDB1774670EFE402C7319D5EC6A6A43D94E439
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
Info: {
Title: Test API,
Version: V1
},
Paths: {
/resource: {
Operations: {
Post: {
OperationId: OperationIdSetInMetadata,
Parameters: [
{
UnresolvedReference: false,
Name: ParameterInMetadata,
Required: false,
Deprecated: false,
AllowEmptyValue: false,
Style: Simple,
Explode: false,
AllowReserved: false
}
],
Deprecated: false
}
},
UnresolvedReference: false
}
},
Components: {},
HashCode: 76DE54DD44D94D07BC803E615ECB0F6D290C3B8803EFB5EADF02C6B180682B1C20BFDD4C9CD50F71D5AD7042B7B4570903F3AF1CC7970ABCA1CEE20FBF971FFD
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
Info: {
Title: Test API,
Version: V1
},
Paths: {
/resource: {
Operations: {
Post: {
Tags: [
{
Name: Fake,
UnresolvedReference: false
}
],
Parameters: [
{
UnresolvedReference: false,
Name: param,
In: Query,
Required: true,
Deprecated: false,
AllowEmptyValue: false,
Style: Form,
Explode: true,
AllowReserved: false,
Schema: {
Type: string,
ReadOnly: false,
WriteOnly: false,
AdditionalPropertiesAllowed: true,
Nullable: false,
Deprecated: false,
UnresolvedReference: false
}
}
],
Responses: {
200: {
Description: OK,
UnresolvedReference: false
}
},
Deprecated: false
}
},
UnresolvedReference: false
}
},
Components: {},
HashCode: A2DDB9D84BC2303C2E8B82FEE969073D4DCAE3D40331C1ED8376E3F427E46C7CAE5AE2791BC5FE1FFFE026EBE90FC10DE8A0409D9F0B6EBC5DBE6CB294DD6A84
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
Info: {
Title: Test API,
Version: V1
},
Paths: {
/resource: {
Operations: {
Post: {
Tags: [
{
Name: Fake,
UnresolvedReference: false
}
],
Parameters: [
{
UnresolvedReference: false,
Name: param,
In: Query,
Required: true,
Deprecated: false,
AllowEmptyValue: false,
Style: Form,
Explode: true,
AllowReserved: false,
Schema: {
Type: string,
ReadOnly: false,
WriteOnly: false,
AdditionalPropertiesAllowed: true,
Nullable: false,
Deprecated: false,
UnresolvedReference: false
}
}
],
Responses: {
200: {
Description: OK,
UnresolvedReference: false
}
},
Deprecated: false
}
},
UnresolvedReference: false
}
},
Components: {},
HashCode: A2DDB9D84BC2303C2E8B82FEE969073D4DCAE3D40331C1ED8376E3F427E46C7CAE5AE2791BC5FE1FFFE026EBE90FC10DE8A0409D9F0B6EBC5DBE6CB294DD6A84
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
Info: {
Title: Test API,
Version: V1
},
Paths: {
/resource: {
Operations: {
Post: {
Tags: [
{
Name: Fake,
UnresolvedReference: false
}
],
Parameters: [
{
UnresolvedReference: false,
Name: param,
In: Query,
Required: true,
Deprecated: false,
AllowEmptyValue: false,
Style: Form,
Explode: true,
AllowReserved: false,
Schema: {
Type: string,
ReadOnly: false,
WriteOnly: false,
AdditionalPropertiesAllowed: true,
Nullable: false,
Deprecated: false,
UnresolvedReference: false
}
}
],
Responses: {
200: {
Description: OK,
UnresolvedReference: false
}
},
Deprecated: false
}
},
UnresolvedReference: false
}
},
Components: {},
HashCode: A2DDB9D84BC2303C2E8B82FEE969073D4DCAE3D40331C1ED8376E3F427E46C7CAE5AE2791BC5FE1FFFE026EBE90FC10DE8A0409D9F0B6EBC5DBE6CB294DD6A84
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
Info: {
Title: Test API,
Version: V1
},
Paths: {
/resource: {
Operations: {
Post: {
Tags: [
{
Name: Fake,
UnresolvedReference: false
}
],
OperationId: SomeRouteName,
Responses: {
200: {
Description: OK,
UnresolvedReference: false
}
},
Deprecated: false
}
},
UnresolvedReference: false
}
},
Components: {},
HashCode: 8A51577C0837548151E3938DC7033AF6AFDE7FD4E5F6F2FE20CC8931B3D18A883C1FB3FE92120D0A44EC31DDE90DDEDE4A237B3138AD45A37278F8924958D5A7
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
Info: {
Title: Test API,
Version: V1
},
Paths: {
/resource: {
Operations: {
Get: {
Tags: [
{
Name: Fake,
UnresolvedReference: false
}
],
Parameters: [
{
UnresolvedReference: false,
Name: param,
In: Header,
Required: false,
Deprecated: false,
AllowEmptyValue: false,
Style: Simple,
Explode: false,
AllowReserved: false,
Schema: {
Type: string,
ReadOnly: false,
WriteOnly: false,
AdditionalPropertiesAllowed: true,
Nullable: false,
Deprecated: false,
UnresolvedReference: false
}
}
],
Responses: {
200: {
Description: OK,
UnresolvedReference: false
}
},
Deprecated: false
}
},
UnresolvedReference: false
}
},
Components: {},
HashCode: E126911C7FB97665966DB7EA833EA70FDF82A779304ECD9B963D5A50C6E0AE51A3180983631720BDCD1BCDA3CAA7E79F0F0042120949EA990884D6188CE77AF1
}
Loading