@@ -53,33 +53,36 @@ public async Task ValidateYamlSpecificationByScenario(
53
53
}
54
54
55
55
[ Theory ]
56
- [ InlineData ( "DemoSample" , AspNetOutputType . Mvc , false , null , null , null ) ]
57
- [ InlineData ( "DemoSample" , AspNetOutputType . Mvc , true , null , null , null ) ]
58
- [ InlineData ( "ExAllResponseTypes" , AspNetOutputType . Mvc , false , null , null , null ) ]
59
- [ InlineData ( "ExAllResponseTypes" , AspNetOutputType . Mvc , true , null , null , null ) ]
60
- [ InlineData ( "ExAsyncEnumerable" , AspNetOutputType . Mvc , false , null , null , null ) ]
61
- [ InlineData ( "ExAsyncEnumerable" , AspNetOutputType . Mvc , true , null , null , null ) ]
62
- [ InlineData ( "ExAsyncEnumerable" , AspNetOutputType . MinimalApi , false , null , null , null ) ]
63
- [ InlineData ( "ExAsyncEnumerable" , AspNetOutputType . MinimalApi , true , null , null , null ) ]
64
- [ InlineData ( "ExGenericPagination" , AspNetOutputType . Mvc , false , null , null , null ) ]
65
- [ InlineData ( "ExGenericPagination" , AspNetOutputType . Mvc , true , null , null , null ) ]
66
- [ InlineData ( "ExNsWithTask" , AspNetOutputType . Mvc , false , null , null , null ) ]
67
- [ InlineData ( "ExNsWithTask" , AspNetOutputType . Mvc , true , null , null , null ) ]
68
- [ InlineData ( "ExUsers" , AspNetOutputType . Mvc , false , null , null , null ) ]
69
- [ InlineData ( "ExUsers" , AspNetOutputType . Mvc , true , null , null , null ) ]
70
- [ InlineData ( "PetStore" , AspNetOutputType . Mvc , false , null , null , null ) ]
71
- [ InlineData ( "PetStore" , AspNetOutputType . Mvc , true , null , null , null ) ]
72
- [ InlineData ( "Structure1" , AspNetOutputType . Mvc , false , "[[apiGroupName]].MyContracts" , "[[apiGroupName]].MyEndpoints" , "[[apiGroupName]].MyHandlers" ) ]
73
- [ InlineData ( "Structure1" , AspNetOutputType . Mvc , true , "[[apiGroupName]].MyContracts" , "[[apiGroupName]].MyEndpoints" , "[[apiGroupName]].MyHandlers" ) ]
74
- [ InlineData ( "Structure1" , AspNetOutputType . MinimalApi , false , "[[apiGroupName]].MyContracts" , "[[apiGroupName]].MyEndpoints" , "[[apiGroupName]].MyHandlers" ) ]
75
- [ InlineData ( "Structure1" , AspNetOutputType . MinimalApi , true , "[[apiGroupName]].MyContracts" , "[[apiGroupName]].MyEndpoints" , "[[apiGroupName]].MyHandlers" ) ]
56
+ [ InlineData ( "DemoSample" , AspNetOutputType . Mvc , false , null , null , null , null , null , null ) ]
57
+ [ InlineData ( "DemoSample" , AspNetOutputType . Mvc , true , null , null , null , null , null , null ) ]
58
+ [ InlineData ( "ExAllResponseTypes" , AspNetOutputType . Mvc , false , null , null , null , null , null , null ) ]
59
+ [ InlineData ( "ExAllResponseTypes" , AspNetOutputType . Mvc , true , null , null , null , null , null , null ) ]
60
+ [ InlineData ( "ExAsyncEnumerable" , AspNetOutputType . Mvc , false , null , null , null , null , null , null ) ]
61
+ [ InlineData ( "ExAsyncEnumerable" , AspNetOutputType . Mvc , true , null , null , null , null , null , null ) ]
62
+ [ InlineData ( "ExAsyncEnumerable" , AspNetOutputType . MinimalApi , false , null , null , null , null , null , null ) ]
63
+ [ InlineData ( "ExAsyncEnumerable" , AspNetOutputType . MinimalApi , true , null , null , null , null , null , null ) ]
64
+ [ InlineData ( "ExGenericPagination" , AspNetOutputType . Mvc , false , null , null , null , null , null , null ) ]
65
+ [ InlineData ( "ExGenericPagination" , AspNetOutputType . Mvc , true , null , null , null , null , null , null ) ]
66
+ [ InlineData ( "ExNsWithTask" , AspNetOutputType . Mvc , false , null , null , null , null , null , null ) ]
67
+ [ InlineData ( "ExNsWithTask" , AspNetOutputType . Mvc , true , null , null , null , null , null , null ) ]
68
+ [ InlineData ( "ExUsers" , AspNetOutputType . Mvc , false , null , null , null , null , null , null ) ]
69
+ [ InlineData ( "ExUsers" , AspNetOutputType . Mvc , true , null , null , null , null , null , null ) ]
70
+ [ InlineData ( "PetStore" , AspNetOutputType . Mvc , false , null , null , null , null , null , null ) ]
71
+ [ InlineData ( "PetStore" , AspNetOutputType . Mvc , true , null , null , null , null , null , null ) ]
72
+ [ InlineData ( "Structure1" , AspNetOutputType . Mvc , false , "[[apiGroupName]].MyContracts" , "[[apiGroupName]].MyContracts" , "[[apiGroupName]]. MyEndpoints" , "[[apiGroupName]].MyEndpoints" , "[[apiGroupName]].MyHandlers ", "[[apiGroupName]].MyHandlers" ) ]
73
+ [ InlineData ( "Structure1" , AspNetOutputType . Mvc , true , "[[apiGroupName]].MyContracts" , "[[apiGroupName]].MyContracts" , "[[apiGroupName]]. MyEndpoints" , "[[apiGroupName]].MyEndpoints" , "[[apiGroupName]].MyHandlers ", "[[apiGroupName]].MyHandlers" ) ]
74
+ [ InlineData ( "Structure1" , AspNetOutputType . MinimalApi , false , "[[apiGroupName]].MyContracts" , "[[apiGroupName]].MyContracts" , "[[apiGroupName]]. MyEndpoints" , "[[apiGroupName]].MyEndpoints" , "[[apiGroupName]].MyHandlers ", "[[apiGroupName]].MyHandlers" ) ]
75
+ [ InlineData ( "Structure1" , AspNetOutputType . MinimalApi , true , "[[apiGroupName]].MyContracts" , "[[apiGroupName]].MyContracts" , "[[apiGroupName]]. MyEndpoints" , "[[apiGroupName]].MyEndpoints" , "[[apiGroupName]].MyHandlers ", "[[apiGroupName]].MyHandlers" ) ]
76
76
public async Task GenerateVerifyAndBuildForServerAllByScenario (
77
77
string scenarioName ,
78
78
AspNetOutputType aspNetOutputType ,
79
79
bool useProblemDetailsAsDefaultResponseBody ,
80
80
string ? contractsLocation ,
81
+ string ? contractsNamespace ,
81
82
string ? endpointsLocation ,
82
- string ? handlersLocation )
83
+ string ? endpointsNamespace ,
84
+ string ? handlersLocation ,
85
+ string ? handlersNamespace )
83
86
{
84
87
// Arrange
85
88
var scenarioPath = CollectScenarioPaths ( ) . First ( x => x . Name == scenarioName ) ;
@@ -93,35 +96,50 @@ public async Task GenerateVerifyAndBuildForServerAllByScenario(
93
96
}
94
97
95
98
// Act & Assert
96
- await AssertGenerateForServerAll ( outputPath , scenarioPath , specificationFile , aspNetOutputType , useProblemDetailsAsDefaultResponseBody , contractsLocation , endpointsLocation , handlersLocation ) ;
99
+ await AssertGenerateForServerAll (
100
+ outputPath ,
101
+ scenarioPath ,
102
+ specificationFile ,
103
+ aspNetOutputType ,
104
+ useProblemDetailsAsDefaultResponseBody ,
105
+ contractsLocation ,
106
+ contractsNamespace ,
107
+ endpointsLocation ,
108
+ endpointsNamespace ,
109
+ handlersLocation ,
110
+ handlersNamespace ) ;
111
+
97
112
await AssertVerifyCsFilesForServerAll ( outputPath , scenarioPath , aspNetOutputType , useProblemDetailsAsDefaultResponseBody ) ;
113
+
98
114
await AssertBuildForServerAll ( outputPath , scenarioPath ) ;
99
115
}
100
116
101
117
[ Theory ]
102
- [ InlineData ( "DemoSample" , false , false , null , null ) ]
103
- [ InlineData ( "DemoSample" , true , false , null , null ) ]
104
- [ InlineData ( "ExAllResponseTypes" , false , false , null , null ) ]
105
- [ InlineData ( "ExAllResponseTypes" , true , false , null , null ) ]
106
- [ InlineData ( "ExAsyncEnumerable" , false , false , null , null ) ]
107
- [ InlineData ( "ExAsyncEnumerable" , true , false , null , null ) ]
108
- [ InlineData ( "ExGenericPagination" , false , false , null , null ) ]
109
- [ InlineData ( "ExGenericPagination" , true , false , null , null ) ]
110
- [ InlineData ( "ExNsWithTask" , false , false , null , null ) ]
111
- [ InlineData ( "ExNsWithTask" , true , false , null , null ) ]
112
- [ InlineData ( "ExUsers" , false , false , null , null ) ]
113
- [ InlineData ( "ExUsers" , true , false , null , null ) ]
114
- [ InlineData ( "PetStore" , false , false , null , null ) ]
115
- [ InlineData ( "PetStore" , true , false , null , null ) ]
116
- [ InlineData ( "Monta" , false , true , null , null ) ]
117
- [ InlineData ( "Structure1" , false , false , "[[apiGroupName]].MyContracts" , "[[apiGroupName]].MyEndpoints" ) ]
118
- [ InlineData ( "Structure1" , true , false , "[[apiGroupName]].MyContracts" , "[[apiGroupName]].MyEndpoints" ) ]
118
+ [ InlineData ( "DemoSample" , false , false , null , null , null , null ) ]
119
+ [ InlineData ( "DemoSample" , true , false , null , null , null , null ) ]
120
+ [ InlineData ( "ExAllResponseTypes" , false , false , null , null , null , null ) ]
121
+ [ InlineData ( "ExAllResponseTypes" , true , false , null , null , null , null ) ]
122
+ [ InlineData ( "ExAsyncEnumerable" , false , false , null , null , null , null ) ]
123
+ [ InlineData ( "ExAsyncEnumerable" , true , false , null , null , null , null ) ]
124
+ [ InlineData ( "ExGenericPagination" , false , false , null , null , null , null ) ]
125
+ [ InlineData ( "ExGenericPagination" , true , false , null , null , null , null ) ]
126
+ [ InlineData ( "ExNsWithTask" , false , false , null , null , null , null ) ]
127
+ [ InlineData ( "ExNsWithTask" , true , false , null , null , null , null ) ]
128
+ [ InlineData ( "ExUsers" , false , false , null , null , null , null ) ]
129
+ [ InlineData ( "ExUsers" , true , false , null , null , null , null ) ]
130
+ [ InlineData ( "PetStore" , false , false , null , null , null , null ) ]
131
+ [ InlineData ( "PetStore" , true , false , null , null , null , null ) ]
132
+ [ InlineData ( "Monta" , false , true , null , null , null , null ) ]
133
+ [ InlineData ( "Structure1" , false , false , "[[apiGroupName]].MyContracts" , "[[apiGroupName]].MyContracts" , "[[apiGroupName]].MyEndpoints" , "[[apiGroupName]]. MyEndpoints") ]
134
+ [ InlineData ( "Structure1" , true , false , "[[apiGroupName]].MyContracts" , "[[apiGroupName]].MyContracts" , "[[apiGroupName]].MyEndpoints" , "[[apiGroupName]]. MyEndpoints") ]
119
135
public async Task GenerateVerifyAndBuildForClientCSharpByScenario (
120
136
string scenarioName ,
121
137
bool useProblemDetailsAsDefaultResponseBody ,
122
138
bool useCustomErrorResponseModel ,
123
139
string ? contractsLocation ,
124
- string ? endpointsLocation )
140
+ string ? contractsNamespace ,
141
+ string ? endpointsLocation ,
142
+ string ? endpointsNamespace )
125
143
{
126
144
// Arrange
127
145
var scenarioPath = CollectScenarioPaths ( ) . First ( x => x . Name == scenarioName ) ;
@@ -136,7 +154,18 @@ public async Task GenerateVerifyAndBuildForClientCSharpByScenario(
136
154
}
137
155
138
156
// Act & Assert
139
- await AssertGenerateForClientCSharp ( outputPath , scenarioPath , specificationFile , optionsFile , useProblemDetailsAsDefaultResponseBody , useCustomErrorResponseModel , contractsLocation , endpointsLocation ) ;
157
+ await AssertGenerateForClientCSharp (
158
+ outputPath ,
159
+ scenarioPath ,
160
+ specificationFile ,
161
+ optionsFile ,
162
+ useProblemDetailsAsDefaultResponseBody ,
163
+ useCustomErrorResponseModel ,
164
+ contractsLocation ,
165
+ contractsNamespace ,
166
+ endpointsLocation ,
167
+ endpointsNamespace ) ;
168
+
140
169
await AssertVerifyCsFilesForClientCSharp ( outputPath , scenarioPath , useProblemDetailsAsDefaultResponseBody , useCustomErrorResponseModel ) ;
141
170
}
142
171
@@ -261,8 +290,11 @@ private static async Task AssertGenerateForServerAll(
261
290
AspNetOutputType aspNetOutputType ,
262
291
bool useProblemDetailsAsDefaultResponseBody ,
263
292
string ? contractsLocation ,
293
+ string ? contractsNamespace ,
264
294
string ? endpointsLocation ,
265
- string ? handlersLocation )
295
+ string ? endpointsNamespace ,
296
+ string ? handlersLocation ,
297
+ string ? handlersNamespace )
266
298
{
267
299
var sbCommands = new StringBuilder ( ) ;
268
300
sbCommands . Append ( "generate server all" ) ;
@@ -289,18 +321,36 @@ private static async Task AssertGenerateForServerAll(
289
321
sbCommands . Append ( contractsLocation ) ;
290
322
}
291
323
324
+ if ( contractsNamespace is not null )
325
+ {
326
+ sbCommands . Append ( " --contractsNamespace " ) ;
327
+ sbCommands . Append ( contractsNamespace ) ;
328
+ }
329
+
292
330
if ( endpointsLocation is not null )
293
331
{
294
332
sbCommands . Append ( " --endpointsLocation " ) ;
295
333
sbCommands . Append ( endpointsLocation ) ;
296
334
}
297
335
336
+ if ( endpointsNamespace is not null )
337
+ {
338
+ sbCommands . Append ( " --endpointsNamespace " ) ;
339
+ sbCommands . Append ( endpointsNamespace ) ;
340
+ }
341
+
298
342
if ( handlersLocation is not null )
299
343
{
300
344
sbCommands . Append ( " --handlersLocation " ) ;
301
345
sbCommands . Append ( handlersLocation ) ;
302
346
}
303
347
348
+ if ( handlersNamespace is not null )
349
+ {
350
+ sbCommands . Append ( " --handlersNamespace " ) ;
351
+ sbCommands . Append ( handlersNamespace ) ;
352
+ }
353
+
304
354
sbCommands . Append ( " --verbose" ) ;
305
355
306
356
var ( isSuccessful , output ) = await ProcessHelper . Execute ( cliExeFile ! , sbCommands . ToString ( ) ) ;
@@ -396,7 +446,9 @@ private static async Task AssertGenerateForClientCSharp(
396
446
bool useProblemDetailsAsDefaultResponseBody ,
397
447
bool useCustomErrorResponseModel ,
398
448
string ? contractsLocation ,
399
- string ? endpointsLocation )
449
+ string ? contractsNamespace ,
450
+ string ? endpointsLocation ,
451
+ string ? endpointsNamespace )
400
452
{
401
453
var sbCommands = new StringBuilder ( ) ;
402
454
sbCommands . Append ( "generate client csharp" ) ;
@@ -424,12 +476,24 @@ private static async Task AssertGenerateForClientCSharp(
424
476
sbCommands . Append ( contractsLocation ) ;
425
477
}
426
478
479
+ if ( contractsNamespace is not null )
480
+ {
481
+ sbCommands . Append ( " --contractsNamespace " ) ;
482
+ sbCommands . Append ( contractsNamespace ) ;
483
+ }
484
+
427
485
if ( endpointsLocation is not null )
428
486
{
429
487
sbCommands . Append ( " --endpointsLocation " ) ;
430
488
sbCommands . Append ( endpointsLocation ) ;
431
489
}
432
490
491
+ if ( endpointsNamespace is not null )
492
+ {
493
+ sbCommands . Append ( " --endpointsNamespace " ) ;
494
+ sbCommands . Append ( endpointsNamespace ) ;
495
+ }
496
+
433
497
sbCommands . Append ( " --verbose" ) ;
434
498
435
499
var ( isSuccessful , output ) = await ProcessHelper . Execute ( cliExeFile ! , sbCommands . ToString ( ) ) ;
0 commit comments