Skip to content

Commit 081469a

Browse files
committed
Updated tests
1 parent 7803fa9 commit 081469a

File tree

257 files changed

+3480
-299
lines changed

Some content is hidden

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

257 files changed

+3480
-299
lines changed

Tests/AdvancedMapping.Repositories.Mapperly.Tests/AdvancedMapping.Repositories.Mapperly.Tests.Api/Configuration/SwashbuckleConfiguration.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static IServiceCollection ConfigureSwagger(this IServiceCollection servic
2525
{
2626
options.SchemaFilter<RequireNonNullablePropertiesSchemaFilter>();
2727
options.SupportNonNullableReferenceTypes();
28-
options.CustomSchemaIds(x => x.FullName?.Replace("+", "_", StringComparison.OrdinalIgnoreCase));
28+
options.CustomSchemaIds(SchemaIdSelector);
2929

3030
var apiXmlFile = Path.Combine(AppContext.BaseDirectory, $"{Assembly.GetExecutingAssembly().GetName().Name}.xml");
3131
if (File.Exists(apiXmlFile))
@@ -87,6 +87,31 @@ public static void UseSwashbuckle(this IApplicationBuilder app, IConfiguration c
8787
});
8888
}
8989

90+
private static string SchemaIdSelector(Type modelType)
91+
{
92+
if (modelType.IsArray)
93+
{
94+
var elementType = modelType.GetElementType()!;
95+
return $"{SchemaIdSelector(elementType)}Array";
96+
}
97+
98+
var typeName = modelType.FullName?.Replace("+", ".") ?? modelType.Name.Replace("+", ".");
99+
100+
if (!modelType.IsConstructedGenericType)
101+
{
102+
return typeName;
103+
}
104+
105+
var genericTypeDefName = modelType.GetGenericTypeDefinition().FullName;
106+
var baseName = (genericTypeDefName?.Split('`')[0] ?? modelType.Name.Split('`')[0]).Replace("+", ".");
107+
108+
var genericArgs = modelType.GetGenericArguments()
109+
.Select(SchemaIdSelector)
110+
.ToArray();
111+
112+
return $"{baseName}_Of_{string.Join("_And_", genericArgs)}";
113+
}
114+
90115
private static void AddSwaggerEndpoints(IApplicationBuilder app, SwaggerUIOptions options)
91116
{
92117
var provider = app.ApplicationServices.GetRequiredService<IApiVersionDescriptionProvider>();

Tests/AdvancedMapping.Repositories.Mapperly.Tests/modules.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<module moduleId="Intent.AspNetCore.Controllers.Dispatch.MediatR" version="6.1.2" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
2222
<module moduleId="Intent.AspNetCore.Controllers.Dispatch.ServiceContract" version="5.2.18" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
2323
<module moduleId="Intent.AspNetCore.HealthChecks" version="2.0.12" supportedClientVersions="[4.3.0-a, 5.0.0-a)" />
24-
<module moduleId="Intent.AspNetCore.Swashbuckle" version="5.1.12-pre.0" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
24+
<module moduleId="Intent.AspNetCore.Swashbuckle" version="5.2.0-pre.0" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
2525
<module moduleId="Intent.AspNetCore.Swashbuckle.Security" version="4.0.10" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
2626
<module moduleId="Intent.AspNetCore.Versioning" version="1.1.8" supportedClientVersions="[4.3.0-a, 5.0.0-a)" />
2727
<module moduleId="Intent.Common" version="3.9.2" supportedClientVersions="[4.5.21-a, 5.0.0-a)" />

Tests/AdvancedMappingCrud.Cosmos.Tests/AdvancedMappingCrud.Cosmos.Tests.Api/Configuration/SwashbuckleConfiguration.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static IServiceCollection ConfigureSwagger(this IServiceCollection servic
3232
{
3333
options.SchemaFilter<RequireNonNullablePropertiesSchemaFilter>();
3434
options.SupportNonNullableReferenceTypes();
35-
options.CustomSchemaIds(x => x.FullName?.Replace("+", "_", StringComparison.OrdinalIgnoreCase));
35+
options.CustomSchemaIds(SchemaIdSelector);
3636

3737
var apiXmlFile = Path.Combine(AppContext.BaseDirectory, $"{Assembly.GetExecutingAssembly().GetName().Name}.xml");
3838
if (File.Exists(apiXmlFile))
@@ -94,6 +94,31 @@ public static void UseSwashbuckle(this IApplicationBuilder app, IConfiguration c
9494
});
9595
}
9696

97+
private static string SchemaIdSelector(Type modelType)
98+
{
99+
if (modelType.IsArray)
100+
{
101+
var elementType = modelType.GetElementType()!;
102+
return $"{SchemaIdSelector(elementType)}Array";
103+
}
104+
105+
var typeName = modelType.FullName?.Replace("+", ".") ?? modelType.Name.Replace("+", ".");
106+
107+
if (!modelType.IsConstructedGenericType)
108+
{
109+
return typeName;
110+
}
111+
112+
var genericTypeDefName = modelType.GetGenericTypeDefinition().FullName;
113+
var baseName = (genericTypeDefName?.Split('`')[0] ?? modelType.Name.Split('`')[0]).Replace("+", ".");
114+
115+
var genericArgs = modelType.GetGenericArguments()
116+
.Select(SchemaIdSelector)
117+
.ToArray();
118+
119+
return $"{baseName}_Of_{string.Join("_And_", genericArgs)}";
120+
}
121+
97122
private static void AddSwaggerEndpoints(IApplicationBuilder app, SwaggerUIOptions options)
98123
{
99124
var provider = app.ApplicationServices.GetRequiredService<IApiVersionDescriptionProvider>();

Tests/AdvancedMappingCrud.Cosmos.Tests/modules.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<module moduleId="Intent.AspNetCore.IntegrationTesting" version="2.0.11-pre.1" supportedClientVersions="[4.5.0-a, 5.0.0-a)" />
2727
<module moduleId="Intent.AspNetCore.IntegrationTests.CRUD" version="1.0.16" supportedClientVersions="[4.3.0-a, 5.0.0-a)" />
2828
<module moduleId="Intent.AspNetCore.ODataQuery" version="1.0.16" supportedClientVersions="[4.3.0-a,5.0.0)" />
29-
<module moduleId="Intent.AspNetCore.Swashbuckle" version="5.1.12-pre.0" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
29+
<module moduleId="Intent.AspNetCore.Swashbuckle" version="5.2.0-pre.0" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
3030
<module moduleId="Intent.AspNetCore.Swashbuckle.Security" version="4.0.10" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
3131
<module moduleId="Intent.AspNetCore.Versioning" version="1.1.8" supportedClientVersions="[4.3.0-a, 5.0.0-a)" />
3232
<module moduleId="Intent.Common" version="3.9.2" supportedClientVersions="[4.5.21-a, 5.0.0-a)" />

Tests/AdvancedMappingCrud.DbContext.ProjectTo.Tests/AdvancedMappingCrud.DbContext.ProjectTo.Tests.Api/Configuration/SwashbuckleConfiguration.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static IServiceCollection ConfigureSwagger(this IServiceCollection servic
3232
{
3333
options.SchemaFilter<RequireNonNullablePropertiesSchemaFilter>();
3434
options.SupportNonNullableReferenceTypes();
35-
options.CustomSchemaIds(x => x.FullName?.Replace("+", "_", StringComparison.OrdinalIgnoreCase));
35+
options.CustomSchemaIds(SchemaIdSelector);
3636

3737
var apiXmlFile = Path.Combine(AppContext.BaseDirectory, $"{Assembly.GetExecutingAssembly().GetName().Name}.xml");
3838
if (File.Exists(apiXmlFile))
@@ -94,6 +94,31 @@ public static void UseSwashbuckle(this IApplicationBuilder app, IConfiguration c
9494
});
9595
}
9696

97+
private static string SchemaIdSelector(Type modelType)
98+
{
99+
if (modelType.IsArray)
100+
{
101+
var elementType = modelType.GetElementType()!;
102+
return $"{SchemaIdSelector(elementType)}Array";
103+
}
104+
105+
var typeName = modelType.FullName?.Replace("+", ".") ?? modelType.Name.Replace("+", ".");
106+
107+
if (!modelType.IsConstructedGenericType)
108+
{
109+
return typeName;
110+
}
111+
112+
var genericTypeDefName = modelType.GetGenericTypeDefinition().FullName;
113+
var baseName = (genericTypeDefName?.Split('`')[0] ?? modelType.Name.Split('`')[0]).Replace("+", ".");
114+
115+
var genericArgs = modelType.GetGenericArguments()
116+
.Select(SchemaIdSelector)
117+
.ToArray();
118+
119+
return $"{baseName}_Of_{string.Join("_And_", genericArgs)}";
120+
}
121+
97122
private static void AddSwaggerEndpoints(IApplicationBuilder app, SwaggerUIOptions options)
98123
{
99124
var provider = app.ApplicationServices.GetRequiredService<IApiVersionDescriptionProvider>();

Tests/AdvancedMappingCrud.DbContext.ProjectTo.Tests/modules.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<module moduleId="Intent.AspNetCore.HealthChecks" version="2.0.12" supportedClientVersions="[4.3.0-a, 5.0.0-a)" />
2626
<module moduleId="Intent.AspNetCore.IntegrationTesting" version="2.0.11-pre.1" supportedClientVersions="[4.5.0-a, 5.0.0-a)" />
2727
<module moduleId="Intent.AspNetCore.IntegrationTests.CRUD" version="1.0.16" supportedClientVersions="[4.3.0-a, 5.0.0-a)" />
28-
<module moduleId="Intent.AspNetCore.Swashbuckle" version="5.1.12-pre.0" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
28+
<module moduleId="Intent.AspNetCore.Swashbuckle" version="5.2.0-pre.0" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
2929
<module moduleId="Intent.AspNetCore.Swashbuckle.Security" version="4.0.10" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
3030
<module moduleId="Intent.AspNetCore.Versioning" version="1.1.8" supportedClientVersions="[4.3.0-a, 5.0.0-a)" />
3131
<module moduleId="Intent.Common" version="3.9.2" supportedClientVersions="[4.5.21-a, 5.0.0-a)" />

Tests/AdvancedMappingCrud.DbContext.Tests/AdvancedMappingCrud.DbContext.Tests.Api/Configuration/SwashbuckleConfiguration.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static IServiceCollection ConfigureSwagger(this IServiceCollection servic
3232
{
3333
options.SchemaFilter<RequireNonNullablePropertiesSchemaFilter>();
3434
options.SupportNonNullableReferenceTypes();
35-
options.CustomSchemaIds(x => x.FullName?.Replace("+", "_", StringComparison.OrdinalIgnoreCase));
35+
options.CustomSchemaIds(SchemaIdSelector);
3636

3737
var apiXmlFile = Path.Combine(AppContext.BaseDirectory, $"{Assembly.GetExecutingAssembly().GetName().Name}.xml");
3838
if (File.Exists(apiXmlFile))
@@ -93,6 +93,31 @@ public static void UseSwashbuckle(this IApplicationBuilder app, IConfiguration c
9393
});
9494
}
9595

96+
private static string SchemaIdSelector(Type modelType)
97+
{
98+
if (modelType.IsArray)
99+
{
100+
var elementType = modelType.GetElementType()!;
101+
return $"{SchemaIdSelector(elementType)}Array";
102+
}
103+
104+
var typeName = modelType.FullName?.Replace("+", ".") ?? modelType.Name.Replace("+", ".");
105+
106+
if (!modelType.IsConstructedGenericType)
107+
{
108+
return typeName;
109+
}
110+
111+
var genericTypeDefName = modelType.GetGenericTypeDefinition().FullName;
112+
var baseName = (genericTypeDefName?.Split('`')[0] ?? modelType.Name.Split('`')[0]).Replace("+", ".");
113+
114+
var genericArgs = modelType.GetGenericArguments()
115+
.Select(SchemaIdSelector)
116+
.ToArray();
117+
118+
return $"{baseName}_Of_{string.Join("_And_", genericArgs)}";
119+
}
120+
96121
private static void AddSwaggerEndpoints(IApplicationBuilder app, SwaggerUIOptions options)
97122
{
98123
var provider = app.ApplicationServices.GetRequiredService<IApiVersionDescriptionProvider>();

Tests/AdvancedMappingCrud.DbContext.Tests/modules.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<module moduleId="Intent.AspNetCore.HealthChecks" version="2.0.12" supportedClientVersions="[4.3.0-a, 5.0.0-a)" />
2626
<module moduleId="Intent.AspNetCore.IntegrationTesting" version="2.0.11-pre.1" supportedClientVersions="[4.5.0-a, 5.0.0-a)" />
2727
<module moduleId="Intent.AspNetCore.IntegrationTests.CRUD" version="1.0.16" supportedClientVersions="[4.3.0-a, 5.0.0-a)" />
28-
<module moduleId="Intent.AspNetCore.Swashbuckle" version="5.1.12-pre.0" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
28+
<module moduleId="Intent.AspNetCore.Swashbuckle" version="5.2.0-pre.0" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
2929
<module moduleId="Intent.AspNetCore.Swashbuckle.Security" version="4.0.10" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
3030
<module moduleId="Intent.AspNetCore.Versioning" version="1.1.8" supportedClientVersions="[4.3.0-a, 5.0.0-a)" />
3131
<module moduleId="Intent.Common" version="3.9.2" supportedClientVersions="[4.5.21-a, 5.0.0-a)" />

Tests/AdvancedMappingCrud.Mongo.Tests/AdvancedMappingCrudMongo.Tests.Api/Configuration/SwashbuckleConfiguration.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static IServiceCollection ConfigureSwagger(this IServiceCollection servic
3232
{
3333
options.SchemaFilter<RequireNonNullablePropertiesSchemaFilter>();
3434
options.SupportNonNullableReferenceTypes();
35-
options.CustomSchemaIds(x => x.FullName?.Replace("+", "_", StringComparison.OrdinalIgnoreCase));
35+
options.CustomSchemaIds(SchemaIdSelector);
3636

3737
var apiXmlFile = Path.Combine(AppContext.BaseDirectory, $"{Assembly.GetExecutingAssembly().GetName().Name}.xml");
3838
if (File.Exists(apiXmlFile))
@@ -93,6 +93,31 @@ public static void UseSwashbuckle(this IApplicationBuilder app, IConfiguration c
9393
});
9494
}
9595

96+
private static string SchemaIdSelector(Type modelType)
97+
{
98+
if (modelType.IsArray)
99+
{
100+
var elementType = modelType.GetElementType()!;
101+
return $"{SchemaIdSelector(elementType)}Array";
102+
}
103+
104+
var typeName = modelType.FullName?.Replace("+", ".") ?? modelType.Name.Replace("+", ".");
105+
106+
if (!modelType.IsConstructedGenericType)
107+
{
108+
return typeName;
109+
}
110+
111+
var genericTypeDefName = modelType.GetGenericTypeDefinition().FullName;
112+
var baseName = (genericTypeDefName?.Split('`')[0] ?? modelType.Name.Split('`')[0]).Replace("+", ".");
113+
114+
var genericArgs = modelType.GetGenericArguments()
115+
.Select(SchemaIdSelector)
116+
.ToArray();
117+
118+
return $"{baseName}_Of_{string.Join("_And_", genericArgs)}";
119+
}
120+
96121
private static void AddSwaggerEndpoints(IApplicationBuilder app, SwaggerUIOptions options)
97122
{
98123
var provider = app.ApplicationServices.GetRequiredService<IApiVersionDescriptionProvider>();

Tests/AdvancedMappingCrud.Mongo.Tests/modules.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<module moduleId="Intent.AspNetCore.HealthChecks" version="2.0.12" supportedClientVersions="[4.3.0-a, 5.0.0-a)" />
2626
<module moduleId="Intent.AspNetCore.IntegrationTesting" version="2.0.11-pre.1" supportedClientVersions="[4.5.0-a, 5.0.0-a)" />
2727
<module moduleId="Intent.AspNetCore.IntegrationTests.CRUD" version="1.0.16" supportedClientVersions="[4.3.0-a, 5.0.0-a)" />
28-
<module moduleId="Intent.AspNetCore.Swashbuckle" version="5.1.12-pre.0" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
28+
<module moduleId="Intent.AspNetCore.Swashbuckle" version="5.2.0-pre.0" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
2929
<module moduleId="Intent.AspNetCore.Swashbuckle.Security" version="4.0.10" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
3030
<module moduleId="Intent.AspNetCore.Versioning" version="1.1.8" supportedClientVersions="[4.3.0-a, 5.0.0-a)" />
3131
<module moduleId="Intent.Common" version="3.9.2" supportedClientVersions="[4.5.21-a, 5.0.0-a)" />

0 commit comments

Comments
 (0)