Skip to content

Commit e462cab

Browse files
authored
Merge pull request #5 from tennisi/swagger_testing
Tests
2 parents 84066cc + 23599fe commit e462cab

File tree

1,569 files changed

+284
-170261
lines changed

Some content is hidden

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

1,569 files changed

+284
-170261
lines changed

.github/workflows/BuildAndPack.yml

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -58,63 +58,63 @@ jobs:
5858
with:
5959
name: artifacts
6060
path: artifacts
61-
windows-latest:
62-
name: windows-latest
63-
runs-on: windows-latest
64-
steps:
65-
- uses: actions/checkout@v3
66-
- uses: actions/setup-dotnet@v3
67-
with:
68-
dotnet-version: |
69-
7.0.x
70-
6.0.x
71-
5.0.x
72-
3.1.x
73-
- name: Cache .nuke/temp, ~/.nuget/packages
74-
uses: actions/cache@v2
75-
with:
76-
path: |
77-
.nuke/temp
78-
~/.nuget/packages
79-
!~/.nuget/packages/stronglytypeid
80-
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
81-
- name: Run './build.cmd Clean Test TestPackages PushToNuGet'
82-
run: ./build.cmd Clean Test TestPackages PushToNuGet
83-
env:
84-
GithubToken: ${{ secrets.GITHUB_TOKEN }}
85-
NuGetToken: ${{ secrets.NUGET_TOKEN }}
86-
MSBuildEnableWorkloadResolver: false
87-
- uses: actions/upload-artifact@v1
88-
with:
89-
name: artifacts
90-
path: artifacts
91-
macOS-latest:
92-
name: macOS-latest
93-
runs-on: macOS-latest
94-
steps:
95-
- uses: actions/checkout@v3
96-
- uses: actions/setup-dotnet@v3
97-
with:
98-
dotnet-version: |
99-
7.0.x
100-
6.0.x
101-
5.0.x
102-
3.1.x
103-
- name: Cache .nuke/temp, ~/.nuget/packages
104-
uses: actions/cache@v2
105-
with:
106-
path: |
107-
.nuke/temp
108-
~/.nuget/packages
109-
!~/.nuget/packages/stronglytypeid
110-
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
111-
- name: Run './build.cmd Clean Test TestPackages PushToNuGet'
112-
run: ./build.cmd Clean Test TestPackages PushToNuGet
113-
env:
114-
GithubToken: ${{ secrets.GITHUB_TOKEN }}
115-
NuGetToken: ${{ secrets.NUGET_TOKEN }}
116-
MSBuildEnableWorkloadResolver: false
117-
- uses: actions/upload-artifact@v1
118-
with:
119-
name: artifacts
120-
path: artifacts
61+
# windows-latest:
62+
# name: windows-latest
63+
# runs-on: windows-latest
64+
# steps:
65+
# - uses: actions/checkout@v3
66+
# - uses: actions/setup-dotnet@v3
67+
# with:
68+
# dotnet-version: |
69+
# 7.0.x
70+
# 6.0.x
71+
# 5.0.x
72+
# 3.1.x
73+
# - name: Cache .nuke/temp, ~/.nuget/packages
74+
# uses: actions/cache@v2
75+
# with:
76+
# path: |
77+
# .nuke/temp
78+
# ~/.nuget/packages
79+
# !~/.nuget/packages/stronglytypeid
80+
# key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
81+
# - name: Run './build.cmd Clean Test TestPackages PushToNuGet'
82+
# run: ./build.cmd Clean Test TestPackages PushToNuGet
83+
# env:
84+
# GithubToken: ${{ secrets.GITHUB_TOKEN }}
85+
# NuGetToken: ${{ secrets.NUGET_TOKEN }}
86+
# MSBuildEnableWorkloadResolver: false
87+
# - uses: actions/upload-artifact@v1
88+
# with:
89+
# name: artifacts
90+
# path: artifacts
91+
# macOS-latest:
92+
# name: macOS-latest
93+
# runs-on: macOS-latest
94+
# steps:
95+
# - uses: actions/checkout@v3
96+
# - uses: actions/setup-dotnet@v3
97+
# with:
98+
# dotnet-version: |
99+
# 7.0.x
100+
# 6.0.x
101+
# 5.0.x
102+
# 3.1.x
103+
# - name: Cache .nuke/temp, ~/.nuget/packages
104+
# uses: actions/cache@v2
105+
# with:
106+
# path: |
107+
# .nuke/temp
108+
# ~/.nuget/packages
109+
# !~/.nuget/packages/stronglytypeid
110+
# key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
111+
# - name: Run './build.cmd Clean Test TestPackages PushToNuGet'
112+
# run: ./build.cmd Clean Test TestPackages PushToNuGet
113+
# env:
114+
# GithubToken: ${{ secrets.GITHUB_TOKEN }}
115+
# NuGetToken: ${{ secrets.NUGET_TOKEN }}
116+
# MSBuildEnableWorkloadResolver: false
117+
# - uses: actions/upload-artifact@v1
118+
# with:
119+
# name: artifacts
120+
# path: artifacts

Directory.Build.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1111
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1212
<PackageIcon>logo.png</PackageIcon>
13-
<PackageProjectUrl>https://github.com/andrewlock/StronglyTypedId</PackageProjectUrl>
13+
<PackageProjectUrl>https://github.com/tennisi/StronglyTypedId</PackageProjectUrl>
1414
<PackageTags>stronglytypedid attribute generator generation codegen codegenerator codegeneration netescapades</PackageTags>
15-
<RepositoryUrl>https://github.com/andrewlock/StronglyTypedId</RepositoryUrl>
15+
<RepositoryUrl>https://github.com/tennisi/StronglyTypedId</RepositoryUrl>
1616
<RepositoryType>git</RepositoryType>
1717
<CheckEolTargetFramework>false</CheckEolTargetFramework>
1818
</PropertyGroup>
@@ -42,4 +42,4 @@
4242

4343
<Import Project="releasenotes.props" />
4444

45-
</Project>
45+
</Project>

StronglyTypedId.sln

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.28803.352
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.4.33122.133
55
MinimumVisualStudioVersion = 15.0.26124.0
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EE1258BD-3422-4F55-B9CF-B4D6C95DAD68}"
77
EndProject
@@ -16,21 +16,25 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1616
README.md = README.md
1717
releasenotes.props = releasenotes.props
1818
version.props = version.props
19+
.github\workflows\BuildAndPack.yml = .github\workflows\BuildAndPack.yml
20+
CHANGELOG.md = CHANGELOG.md
21+
build.sh = build.sh
22+
NuGet.integration-tests.config = NuGet.integration-tests.config
1923
EndProjectSection
2024
EndProject
21-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StronglyTypedIds", "src\StronglyTypedIds\StronglyTypedIds.csproj", "{9C0F3A36-ED47-4D0F-B736-EFC559C9E2DA}"
25+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StronglyTypedIds", "src\StronglyTypedIds\StronglyTypedIds.csproj", "{9C0F3A36-ED47-4D0F-B736-EFC559C9E2DA}"
2226
EndProject
23-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StronglyTypedIds.Tests", "test\StronglyTypedIds.Tests\StronglyTypedIds.Tests.csproj", "{00B5ED3F-827D-41CD-9AF2-A9A20A6604E1}"
27+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StronglyTypedIds.Tests", "test\StronglyTypedIds.Tests\StronglyTypedIds.Tests.csproj", "{00B5ED3F-827D-41CD-9AF2-A9A20A6604E1}"
2428
EndProject
25-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StronglyTypedIds.IntegrationTests", "test\StronglyTypedIds.IntegrationTests\StronglyTypedIds.IntegrationTests.csproj", "{09F7364F-8CE9-4E9D-9BB7-B4CEBF682904}"
29+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StronglyTypedIds.IntegrationTests", "test\StronglyTypedIds.IntegrationTests\StronglyTypedIds.IntegrationTests.csproj", "{09F7364F-8CE9-4E9D-9BB7-B4CEBF682904}"
2630
EndProject
2731
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{E13FB452-2D47-4719-8BAA-7B695D79AF3A}"
2832
EndProject
29-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StronglyTypedIds.Attributes", "src\StronglyTypedIds.Attributes\StronglyTypedIds.Attributes.csproj", "{F25F6E67-E62A-4075-86CF-4C4EDD7E4883}"
33+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StronglyTypedIds.Attributes", "src\StronglyTypedIds.Attributes\StronglyTypedIds.Attributes.csproj", "{F25F6E67-E62A-4075-86CF-4C4EDD7E4883}"
3034
EndProject
31-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StronglyTypedIds.Nuget.IntegrationTests", "test\StronglyTypedIds.Nuget.IntegrationTests\StronglyTypedIds.Nuget.IntegrationTests.csproj", "{A7355210-7DDC-4968-84B7-79002113EA6E}"
35+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StronglyTypedIds.Nuget.IntegrationTests", "test\StronglyTypedIds.Nuget.IntegrationTests\StronglyTypedIds.Nuget.IntegrationTests.csproj", "{A7355210-7DDC-4968-84B7-79002113EA6E}"
3236
EndProject
33-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StronglyTypedIds.Nuget.Attributes.IntegrationTests", "test\StronglyTypedIds.Nuget.Attributes.IntegrationTests\StronglyTypedIds.Nuget.Attributes.IntegrationTests.csproj", "{19A9B323-8C0B-4D1B-A20C-8CECFFD37F23}"
37+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StronglyTypedIds.Nuget.Attributes.IntegrationTests", "test\StronglyTypedIds.Nuget.Attributes.IntegrationTests\StronglyTypedIds.Nuget.Attributes.IntegrationTests.csproj", "{19A9B323-8C0B-4D1B-A20C-8CECFFD37F23}"
3438
EndProject
3539
Global
3640
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -42,8 +46,6 @@ Global
4246
Release|x86 = Release|x86
4347
EndGlobalSection
4448
GlobalSection(ProjectConfigurationPlatforms) = postSolution
45-
{E13FB452-2D47-4719-8BAA-7B695D79AF3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
46-
{E13FB452-2D47-4719-8BAA-7B695D79AF3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
4749
{9C0F3A36-ED47-4D0F-B736-EFC559C9E2DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
4850
{9C0F3A36-ED47-4D0F-B736-EFC559C9E2DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
4951
{9C0F3A36-ED47-4D0F-B736-EFC559C9E2DA}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -80,6 +82,16 @@ Global
8082
{09F7364F-8CE9-4E9D-9BB7-B4CEBF682904}.Release|x64.Build.0 = Release|Any CPU
8183
{09F7364F-8CE9-4E9D-9BB7-B4CEBF682904}.Release|x86.ActiveCfg = Release|Any CPU
8284
{09F7364F-8CE9-4E9D-9BB7-B4CEBF682904}.Release|x86.Build.0 = Release|Any CPU
85+
{E13FB452-2D47-4719-8BAA-7B695D79AF3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
86+
{E13FB452-2D47-4719-8BAA-7B695D79AF3A}.Debug|x64.ActiveCfg = Debug|Any CPU
87+
{E13FB452-2D47-4719-8BAA-7B695D79AF3A}.Debug|x64.Build.0 = Debug|Any CPU
88+
{E13FB452-2D47-4719-8BAA-7B695D79AF3A}.Debug|x86.ActiveCfg = Debug|Any CPU
89+
{E13FB452-2D47-4719-8BAA-7B695D79AF3A}.Debug|x86.Build.0 = Debug|Any CPU
90+
{E13FB452-2D47-4719-8BAA-7B695D79AF3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
91+
{E13FB452-2D47-4719-8BAA-7B695D79AF3A}.Release|x64.ActiveCfg = Release|Any CPU
92+
{E13FB452-2D47-4719-8BAA-7B695D79AF3A}.Release|x64.Build.0 = Release|Any CPU
93+
{E13FB452-2D47-4719-8BAA-7B695D79AF3A}.Release|x86.ActiveCfg = Release|Any CPU
94+
{E13FB452-2D47-4719-8BAA-7B695D79AF3A}.Release|x86.Build.0 = Release|Any CPU
8395
{F25F6E67-E62A-4075-86CF-4C4EDD7E4883}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
8496
{F25F6E67-E62A-4075-86CF-4C4EDD7E4883}.Debug|Any CPU.Build.0 = Debug|Any CPU
8597
{F25F6E67-E62A-4075-86CF-4C4EDD7E4883}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -93,12 +105,14 @@ Global
93105
{F25F6E67-E62A-4075-86CF-4C4EDD7E4883}.Release|x86.ActiveCfg = Release|Any CPU
94106
{F25F6E67-E62A-4075-86CF-4C4EDD7E4883}.Release|x86.Build.0 = Release|Any CPU
95107
{A7355210-7DDC-4968-84B7-79002113EA6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
108+
{A7355210-7DDC-4968-84B7-79002113EA6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
96109
{A7355210-7DDC-4968-84B7-79002113EA6E}.Debug|x64.ActiveCfg = Debug|Any CPU
97110
{A7355210-7DDC-4968-84B7-79002113EA6E}.Debug|x86.ActiveCfg = Debug|Any CPU
98111
{A7355210-7DDC-4968-84B7-79002113EA6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
99112
{A7355210-7DDC-4968-84B7-79002113EA6E}.Release|x64.ActiveCfg = Release|Any CPU
100113
{A7355210-7DDC-4968-84B7-79002113EA6E}.Release|x86.ActiveCfg = Release|Any CPU
101114
{19A9B323-8C0B-4D1B-A20C-8CECFFD37F23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
115+
{19A9B323-8C0B-4D1B-A20C-8CECFFD37F23}.Debug|Any CPU.Build.0 = Debug|Any CPU
102116
{19A9B323-8C0B-4D1B-A20C-8CECFFD37F23}.Debug|x64.ActiveCfg = Debug|Any CPU
103117
{19A9B323-8C0B-4D1B-A20C-8CECFFD37F23}.Debug|x86.ActiveCfg = Debug|Any CPU
104118
{19A9B323-8C0B-4D1B-A20C-8CECFFD37F23}.Release|Any CPU.ActiveCfg = Release|Any CPU

build/Build.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class Build : NukeBuild
146146

147147
Target PushToNuGet => _ => _
148148
.DependsOn(Compile)
149-
.OnlyWhenStatic(() => IsTag && IsServerBuild && IsWin)
149+
.OnlyWhenStatic(() => true || ( IsTag && IsServerBuild && IsWin ))
150150
.Requires(() => NuGetToken)
151151
.After(Pack)
152152
.Executes(() =>

src/StronglyTypedIds/StronglyTypedIds.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<IncludeBuildOutput>false</IncludeBuildOutput>
66
<Nullable>enable</Nullable>
7-
<PackageId>StronglyTypedId</PackageId>
7+
<PackageId>Tennisi.StronglyTypedId</PackageId>
88
<Description>A source generator for creating strongly-typed IDs by decorating with a [StronglyTypedId] attribute</Description>
99
</PropertyGroup>
1010

@@ -26,4 +26,4 @@
2626
<None Include="$(OutputPath)\StronglyTypedIds.Attributes.dll" Pack="true" PackagePath="lib\netstandard2.0" Visible="true" />
2727
</ItemGroup>
2828

29-
</Project>
29+
</Project>

test/StronglyTypedIds.IntegrationTests/StronglyTypedIds.IntegrationTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<TargetFrameworks>netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
55
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net48;$(TargetFrameworks)</TargetFrameworks>
66
<IsPackable>false</IsPackable>
7+
<Nullable>enable</Nullable>
78
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
89
</PropertyGroup>
910

test/StronglyTypedIds.Nuget.Attributes.IntegrationTests/StronglyTypedIds.Nuget.Attributes.IntegrationTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="StronglyTypedId" Version="$(Version)" ExcludeAssets="compile;runtime" PrivateAssets="all" />
20+
<PackageReference Include="Tennisi.StronglyTypedId" Version="$(Version)" ExcludeAssets="compile;runtime" PrivateAssets="all" />
2121
</ItemGroup>
2222

2323
<Import Project="$(MSBuildThisFileDirectory)..\IntegrationLibraries.props" />

test/StronglyTypedIds.Nuget.IntegrationTests/StronglyTypedIds.Nuget.IntegrationTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</ItemGroup>
1717

1818
<ItemGroup>
19-
<PackageReference Include="StronglyTypedId" Version="$(Version)" PrivateAssets="all" />
19+
<PackageReference Include="Tennisi.StronglyTypedId" Version="$(Version)" PrivateAssets="all" />
2020
</ItemGroup>
2121

2222
<Import Project="$(MSBuildThisFileDirectory)..\IntegrationLibraries.props" />

test/StronglyTypedIds.Tests/Snapshots/SourceGenerationHelperSnapshotTests.GeneratesFullIdCorrectly_type=Guid.verified.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
[Newtonsoft.Json.JsonConverter(typeof(MyTestIdNewtonsoftJsonConverter))]
1313
[System.Text.Json.Serialization.JsonConverter(typeof(MyTestIdSystemTextJsonConverter))]
1414
[System.ComponentModel.TypeConverter(typeof(MyTestIdTypeConverter))]
15+
[Swashbuckle.AspNetCore.Annotations.SwaggerSchemaFilter(typeof(MyTestIdSchemaFilter))]
1516
readonly partial struct MyTestId : System.IComparable<MyTestId>, System.IEquatable<MyTestId>
1617
{
1718
public System.Guid Value { get; }
@@ -140,4 +141,17 @@
140141
writer.WriteStringValue(value.Value);
141142
}
142143
}
144+
145+
class MyTestIdSchemaFilter : Swashbuckle.AspNetCore.SwaggerGen.ISchemaFilter
146+
{
147+
public void Apply(Microsoft.OpenApi.Models.OpenApiSchema schema, Swashbuckle.AspNetCore.SwaggerGen.SchemaFilterContext context)
148+
{
149+
var idSchema = new Microsoft.OpenApi.Models.OpenApiSchema {Type = "string", Format = "uuid"};
150+
schema.Type = idSchema.Type;
151+
schema.Format = idSchema.Format;
152+
schema.Example = idSchema.Example;
153+
schema.Default = idSchema.Default;
154+
schema.Properties = idSchema.Properties;
155+
}
156+
}
143157
}

test/StronglyTypedIds.Tests/Snapshots/SourceGenerationHelperSnapshotTests.GeneratesFullIdCorrectly_type=Int.verified.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
[Newtonsoft.Json.JsonConverter(typeof(MyTestIdNewtonsoftJsonConverter))]
1313
[System.Text.Json.Serialization.JsonConverter(typeof(MyTestIdSystemTextJsonConverter))]
1414
[System.ComponentModel.TypeConverter(typeof(MyTestIdTypeConverter))]
15+
[Swashbuckle.AspNetCore.Annotations.SwaggerSchemaFilter(typeof(MyTestIdSchemaFilter))]
1516
readonly partial struct MyTestId : System.IComparable<MyTestId>, System.IEquatable<MyTestId>
1617
{
1718
public int Value { get; }
@@ -140,4 +141,17 @@
140141
writer.WriteNumberValue(value.Value);
141142
}
142143
}
144+
145+
class MyTestIdSchemaFilter : Swashbuckle.AspNetCore.SwaggerGen.ISchemaFilter
146+
{
147+
public void Apply(Microsoft.OpenApi.Models.OpenApiSchema schema, Swashbuckle.AspNetCore.SwaggerGen.SchemaFilterContext context)
148+
{
149+
var idSchema = new Microsoft.OpenApi.Models.OpenApiSchema {Type = "integer", Format = "int32"};
150+
schema.Type = idSchema.Type;
151+
schema.Format = idSchema.Format;
152+
schema.Example = idSchema.Example;
153+
schema.Default = idSchema.Default;
154+
schema.Properties = idSchema.Properties;
155+
}
156+
}
143157
}

0 commit comments

Comments
 (0)