@@ -245,16 +245,17 @@ Describe "Optional parameter tests" -Tag ScenarioTest {
245245
246246Describe " ParameterTypes tests" - Tag @ (' ParameterTypes' , ' ScenarioTest' ) {
247247 BeforeAll {
248+ $ModuleName = ' Generated.ParamTypes.Module'
248249 Import-Module (Join-Path - Path $PSScriptRoot - ChildPath " .." | Join-Path - ChildPath " PSSwagger" | Join-Path - ChildPath " PSSwaggerUtility" | `
249250 Join-Path - ChildPath " PSSwaggerUtility.psd1" ) - Force
250- Initialize-Test - GeneratedModuleName " Generated.ParamTypes.Module " - GeneratedModuleVersion " 0.0.2" - TestApiName " ParameterTypes" `
251+ Initialize-Test - GeneratedModuleName $ModuleName - GeneratedModuleVersion " 0.0.2" - TestApiName " ParameterTypes" `
251252 - TestSpecFileName " ParameterTypesSpec.json" - TestDataFileName " ParameterTypesData.json" `
252253 - PsSwaggerPath (Join-Path - Path $PSScriptRoot - ChildPath " .." | Join-Path - ChildPath " PSSwagger" ) - TestRootPath $PSScriptRoot
253254
254255 # Import generated module
255256 Write-Verbose " Importing modules"
256257 Import-Module (Join-Path - Path $PSScriptRoot - ChildPath " Generated" | `
257- Join-Path - ChildPath " Generated.ParamTypes.Module " )
258+ Join-Path - ChildPath $ModuleName )
258259
259260 $processes = Start-JsonServer - TestRootPath $PSScriptRoot - TestApiName " ParameterTypes"
260261 if ($global :PSSwaggerTest_EnableTracing -and $script :EnableTracer ) {
@@ -325,7 +326,6 @@ Describe "ParameterTypes tests" -Tag @('ParameterTypes','ScenarioTest') {
325326 }
326327
327328 It " Test dummy definition references" {
328- $ModuleName = ' Generated.ParamTypes.Module'
329329 $ev = $null
330330 $CommandList = Get-Command - Module $ModuleName - ErrorVariable ev
331331 $ev | Should BeNullOrEmpty
@@ -345,7 +345,6 @@ Describe "ParameterTypes tests" -Tag @('ParameterTypes','ScenarioTest') {
345345 }
346346
347347 It " Test CSharp reserved keywords as definition or type names" {
348- $ModuleName = ' Generated.ParamTypes.Module'
349348 $ev = $null
350349 $CommandList = Get-Command - Module $ModuleName - ErrorVariable ev
351350 $ev | Should BeNullOrEmpty
@@ -375,7 +374,6 @@ Describe "ParameterTypes tests" -Tag @('ParameterTypes','ScenarioTest') {
375374 }
376375
377376 It " Test Definition commands 'New-<NestedDefinition>Object' for nested definitions" {
378- $ModuleName = ' Generated.ParamTypes.Module'
379377 $ev = $null
380378 $CommandList = Get-Command - Module $ModuleName - ErrorVariable ev
381379 $ev | Should BeNullOrEmpty
@@ -400,7 +398,6 @@ Describe "ParameterTypes tests" -Tag @('ParameterTypes','ScenarioTest') {
400398 }
401399
402400 It ' Test parameter types with array of items in AdditionalProperties json schema' {
403- $ModuleName = ' Generated.ParamTypes.Module'
404401 $ev = $null
405402 $null = Get-Command - Module $ModuleName - Syntax - ErrorVariable ev
406403 $ev | Should BeNullOrEmpty
@@ -413,8 +410,6 @@ Describe "ParameterTypes tests" -Tag @('ParameterTypes','ScenarioTest') {
413410 }
414411
415412 It ' Test parameter types with references to enum definition type' {
416- $ModuleName = ' Generated.ParamTypes.Module'
417-
418413 # Swagger operation command with parameter type reference to enum definition type
419414 $OperationCommandInfo = Get-Command - Name Get-PathWithEnumDefinitionType - Module $ModuleName
420415
@@ -453,7 +448,7 @@ Describe "ParameterTypes tests" -Tag @('ParameterTypes','ScenarioTest') {
453448 }
454449}
455450
456- Describe " AzureExtensions" {
451+ Describe " AzureExtensions" - Tag @ ( ' AzureExtension ' , ' ScenarioTest ' ) {
457452 BeforeAll {
458453 Import-Module (Join-Path - Path $PSScriptRoot - ChildPath " .." | Join-Path - ChildPath " PSSwagger" | Join-Path - ChildPath " PSSwaggerUtility" | `
459454 Join-Path - ChildPath " PSSwaggerUtility.psd1" ) - Force
@@ -1118,3 +1113,32 @@ Describe "Pre-compiled SDK Assmebly scenario tests" -Tag @('SDKAssembly','Scenar
11181113 (Remove-TestErrorId - FullyQualifiedErrorId $ev.FullyQualifiedErrorId ) | Should Be ' UnableToExtractDetailsFromSdkAssembly,Update-PathFunctionDetails'
11191114 }
11201115}
1116+
1117+ Describe " Output type scenario tests" - Tag @ (' OutputType' , ' ScenarioTest' ) {
1118+ BeforeAll {
1119+ $ModuleName = ' Generated.AzExt.OutputType.Module'
1120+ $SwaggerSpecPath = Join-Path - Path $PSScriptRoot - ChildPath ' Data' | Join-Path - ChildPath ' AzureExtensions' | Join-Path - ChildPath ' AzureExtensionsSpec.json'
1121+ $GeneratedPath = Join-Path - Path $PSScriptRoot - ChildPath ' Generated'
1122+ $GeneratedModuleBase = Join-Path - Path $GeneratedPath - ChildPath $ModuleName
1123+ if (Test-Path - Path $GeneratedModuleBase - PathType Container) {
1124+ Remove-Item - Path $GeneratedModuleBase - Recurse - Force
1125+ }
1126+
1127+ $params = @ {
1128+ SpecificationPath = $SwaggerSpecPath
1129+ Name = $ModuleName
1130+ UseAzureCsharpGenerator = $true
1131+ Path = $GeneratedPath
1132+ ConfirmBootstrap = $true
1133+ Verbose = $true
1134+ }
1135+ Invoke-NewPSSwaggerModuleCommand - NewPSSwaggerModuleParameters $params
1136+
1137+ Import-Module $GeneratedModuleBase - Force
1138+ }
1139+
1140+ It ' Test output type of swagger operation which supports x-ms-pageable' {
1141+ $CommandInfo = Get-Command - Name Get-IotHubResourceEventHubConsumerGroup - Module $ModuleName
1142+ $CommandInfo.OutputType.Type.ToString () | Should BeExactly ' System.String'
1143+ }
1144+ }
0 commit comments