@@ -53,33 +53,36 @@ public async Task ValidateYamlSpecificationByScenario(
5353 }
5454
5555 [ 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" ) ]
7676 public async Task GenerateVerifyAndBuildForServerAllByScenario (
7777 string scenarioName ,
7878 AspNetOutputType aspNetOutputType ,
7979 bool useProblemDetailsAsDefaultResponseBody ,
8080 string ? contractsLocation ,
81+ string ? contractsNamespace ,
8182 string ? endpointsLocation ,
82- string ? handlersLocation )
83+ string ? endpointsNamespace ,
84+ string ? handlersLocation ,
85+ string ? handlersNamespace )
8386 {
8487 // Arrange
8588 var scenarioPath = CollectScenarioPaths ( ) . First ( x => x . Name == scenarioName ) ;
@@ -93,35 +96,50 @@ public async Task GenerateVerifyAndBuildForServerAllByScenario(
9396 }
9497
9598 // 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+
97112 await AssertVerifyCsFilesForServerAll ( outputPath , scenarioPath , aspNetOutputType , useProblemDetailsAsDefaultResponseBody ) ;
113+
98114 await AssertBuildForServerAll ( outputPath , scenarioPath ) ;
99115 }
100116
101117 [ 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") ]
119135 public async Task GenerateVerifyAndBuildForClientCSharpByScenario (
120136 string scenarioName ,
121137 bool useProblemDetailsAsDefaultResponseBody ,
122138 bool useCustomErrorResponseModel ,
123139 string ? contractsLocation ,
124- string ? endpointsLocation )
140+ string ? contractsNamespace ,
141+ string ? endpointsLocation ,
142+ string ? endpointsNamespace )
125143 {
126144 // Arrange
127145 var scenarioPath = CollectScenarioPaths ( ) . First ( x => x . Name == scenarioName ) ;
@@ -136,7 +154,18 @@ public async Task GenerateVerifyAndBuildForClientCSharpByScenario(
136154 }
137155
138156 // 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+
140169 await AssertVerifyCsFilesForClientCSharp ( outputPath , scenarioPath , useProblemDetailsAsDefaultResponseBody , useCustomErrorResponseModel ) ;
141170 }
142171
@@ -261,8 +290,11 @@ private static async Task AssertGenerateForServerAll(
261290 AspNetOutputType aspNetOutputType ,
262291 bool useProblemDetailsAsDefaultResponseBody ,
263292 string ? contractsLocation ,
293+ string ? contractsNamespace ,
264294 string ? endpointsLocation ,
265- string ? handlersLocation )
295+ string ? endpointsNamespace ,
296+ string ? handlersLocation ,
297+ string ? handlersNamespace )
266298 {
267299 var sbCommands = new StringBuilder ( ) ;
268300 sbCommands . Append ( "generate server all" ) ;
@@ -289,18 +321,36 @@ private static async Task AssertGenerateForServerAll(
289321 sbCommands . Append ( contractsLocation ) ;
290322 }
291323
324+ if ( contractsNamespace is not null )
325+ {
326+ sbCommands . Append ( " --contractsNamespace " ) ;
327+ sbCommands . Append ( contractsNamespace ) ;
328+ }
329+
292330 if ( endpointsLocation is not null )
293331 {
294332 sbCommands . Append ( " --endpointsLocation " ) ;
295333 sbCommands . Append ( endpointsLocation ) ;
296334 }
297335
336+ if ( endpointsNamespace is not null )
337+ {
338+ sbCommands . Append ( " --endpointsNamespace " ) ;
339+ sbCommands . Append ( endpointsNamespace ) ;
340+ }
341+
298342 if ( handlersLocation is not null )
299343 {
300344 sbCommands . Append ( " --handlersLocation " ) ;
301345 sbCommands . Append ( handlersLocation ) ;
302346 }
303347
348+ if ( handlersNamespace is not null )
349+ {
350+ sbCommands . Append ( " --handlersNamespace " ) ;
351+ sbCommands . Append ( handlersNamespace ) ;
352+ }
353+
304354 sbCommands . Append ( " --verbose" ) ;
305355
306356 var ( isSuccessful , output ) = await ProcessHelper . Execute ( cliExeFile ! , sbCommands . ToString ( ) ) ;
@@ -396,7 +446,9 @@ private static async Task AssertGenerateForClientCSharp(
396446 bool useProblemDetailsAsDefaultResponseBody ,
397447 bool useCustomErrorResponseModel ,
398448 string ? contractsLocation ,
399- string ? endpointsLocation )
449+ string ? contractsNamespace ,
450+ string ? endpointsLocation ,
451+ string ? endpointsNamespace )
400452 {
401453 var sbCommands = new StringBuilder ( ) ;
402454 sbCommands . Append ( "generate client csharp" ) ;
@@ -424,12 +476,24 @@ private static async Task AssertGenerateForClientCSharp(
424476 sbCommands . Append ( contractsLocation ) ;
425477 }
426478
479+ if ( contractsNamespace is not null )
480+ {
481+ sbCommands . Append ( " --contractsNamespace " ) ;
482+ sbCommands . Append ( contractsNamespace ) ;
483+ }
484+
427485 if ( endpointsLocation is not null )
428486 {
429487 sbCommands . Append ( " --endpointsLocation " ) ;
430488 sbCommands . Append ( endpointsLocation ) ;
431489 }
432490
491+ if ( endpointsNamespace is not null )
492+ {
493+ sbCommands . Append ( " --endpointsNamespace " ) ;
494+ sbCommands . Append ( endpointsNamespace ) ;
495+ }
496+
433497 sbCommands . Append ( " --verbose" ) ;
434498
435499 var ( isSuccessful , output ) = await ProcessHelper . Execute ( cliExeFile ! , sbCommands . ToString ( ) ) ;
0 commit comments