diff --git a/appveyor.yml b/appveyor.yml index d3c02aa19f1e..0da5ff07a0c8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -32,7 +32,7 @@ install: - git clone https://github.com/wing328/swagger-samples - ps: Start-Process -FilePath 'C:\maven\apache-maven-3.2.5\bin\mvn' -ArgumentList 'jetty:run' -WorkingDirectory "$env:appveyor_build_folder\swagger-samples\java\java-jersey-jaxrs-ci" - ps: $PSVersionTable.PSVersion - - ps: Install-Module Pester -Force -Scope CurrentUser -RequiredVersion 4.3.1 + - ps: Install-Module Pester -Force -Scope CurrentUser build_script: - dotnet --info # build C# API client (netcore) diff --git a/modules/openapi-generator/src/main/resources/powershell/api_test.mustache b/modules/openapi-generator/src/main/resources/powershell/api_test.mustache index 52fe4b5f16fc..9c3362aad55e 100644 --- a/modules/openapi-generator/src/main/resources/powershell/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/powershell/api_test.mustache @@ -5,8 +5,8 @@ Describe -tag '{{{packageName}}}' -name '{{{apiNamePrefix}}}{{{classname}}}' { Context '{{{vendorExtensions.x-powershell-method-name}}}' { It 'Test {{{vendorExtensions.x-powershell-method-name}}}' { #$TestResult = Invoke-PetApiGetPetById{{#allParams}} -{{{paramName}}} "TEST_VALUE"{{/allParams}} - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } diff --git a/modules/openapi-generator/src/main/resources/powershell/model_test.mustache b/modules/openapi-generator/src/main/resources/powershell/model_test.mustache index f2d67a306ea5..411fd29efb8f 100644 --- a/modules/openapi-generator/src/main/resources/powershell/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/powershell/model_test.mustache @@ -6,8 +6,8 @@ Describe -tag '{{{packageName}}}' -name '{{{apiNamePrefix}}}{{{classname}}}' { It 'Initialize-{{{apiNamePrefix}}}{{{classname}}}' { # a simple test to create an object #$NewObject = Initialize-{{{apiNamePrefix}}}{{{classname}}}{{#vars}} -{{name}} "TEST_VALUE"{{/vars}} - #$NewObject | Should BeOfType {{classname}} - #$NewObject.property | Should Be 0 + #$NewObject | Should -BeOfType {{classname}} + #$NewObject.property | Should -Be 0 } } } diff --git a/samples/client/petstore/powershell/.openapi-generator/FILES b/samples/client/petstore/powershell/.openapi-generator/FILES index 4708e0914a54..2849a3267b94 100644 --- a/samples/client/petstore/powershell/.openapi-generator/FILES +++ b/samples/client/petstore/powershell/.openapi-generator/FILES @@ -31,3 +31,14 @@ src/PSPetstore/Private/PSApiClient.ps1 src/PSPetstore/Private/PSHttpSignatureAuth.ps1 src/PSPetstore/Private/PSRSAEncryptionProvider.cs src/PSPetstore/en-US/about_PSPetstore.help.txt +tests/Api/PSPetApi.Tests.ps1 +tests/Api/PSStoreApi.Tests.ps1 +tests/Api/PSUserApi.Tests.ps1 +tests/Model/ApiResponse.Tests.ps1 +tests/Model/Category.Tests.ps1 +tests/Model/InlineObject.Tests.ps1 +tests/Model/InlineObject1.Tests.ps1 +tests/Model/Order.Tests.ps1 +tests/Model/Pet.Tests.ps1 +tests/Model/Tag.Tests.ps1 +tests/Model/User.Tests.ps1 diff --git a/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psd1 b/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psd1 index 7b9c725fae2d..4322e265be2b 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psd1 +++ b/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psd1 @@ -3,7 +3,7 @@ # # Generated by: OpenAPI Generator Team # -# Generated on: 6/3/20 +# Generated on: 6/4/20 # @{ diff --git a/samples/client/petstore/powershell/tests/Api/PSPetApi.Tests.ps1 b/samples/client/petstore/powershell/tests/Api/PSPetApi.Tests.ps1 index 75635ae54f58..a64121dd996b 100644 --- a/samples/client/petstore/powershell/tests/Api/PSPetApi.Tests.ps1 +++ b/samples/client/petstore/powershell/tests/Api/PSPetApi.Tests.ps1 @@ -5,68 +5,68 @@ # Generated by OpenAPI Generator: https://openapi-generator.tech # -Describe -tag 'PSPetstore' -name 'PSPetApi' { +Describe -tag 'PSPetstore' -name 'PSPSPetApi' { Context 'Add-PSPet' { It 'Test Add-PSPet' { #$TestResult = Invoke-PetApiGetPetById -Pet "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } Context 'Remove-Pet' { It 'Test Remove-Pet' { #$TestResult = Invoke-PetApiGetPetById -PetId "TEST_VALUE" -ApiKey "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } Context 'Find-PSPetsByStatus' { It 'Test Find-PSPetsByStatus' { #$TestResult = Invoke-PetApiGetPetById -Status "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } Context 'Find-PSPetsByTags' { It 'Test Find-PSPetsByTags' { #$TestResult = Invoke-PetApiGetPetById -Tags "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } Context 'Get-PSPetById' { It 'Test Get-PSPetById' { #$TestResult = Invoke-PetApiGetPetById -PetId "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } Context 'Update-PSPet' { It 'Test Update-PSPet' { #$TestResult = Invoke-PetApiGetPetById -Pet "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } Context 'Update-PSPetWithForm' { It 'Test Update-PSPetWithForm' { #$TestResult = Invoke-PetApiGetPetById -PetId "TEST_VALUE" -Name "TEST_VALUE" -Status "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } Context 'Invoke-PSUploadFile' { It 'Test Invoke-PSUploadFile' { #$TestResult = Invoke-PetApiGetPetById -PetId "TEST_VALUE" -AdditionalMetadata "TEST_VALUE" -File "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } diff --git a/samples/client/petstore/powershell/tests/Api/PSStoreApi.Tests.ps1 b/samples/client/petstore/powershell/tests/Api/PSStoreApi.Tests.ps1 index de3c4226f940..95399b034f71 100644 --- a/samples/client/petstore/powershell/tests/Api/PSStoreApi.Tests.ps1 +++ b/samples/client/petstore/powershell/tests/Api/PSStoreApi.Tests.ps1 @@ -5,36 +5,36 @@ # Generated by OpenAPI Generator: https://openapi-generator.tech # -Describe -tag 'PSPetstore' -name 'PSStoreApi' { +Describe -tag 'PSPetstore' -name 'PSPSStoreApi' { Context 'Remove-PSOrder' { It 'Test Remove-PSOrder' { #$TestResult = Invoke-PetApiGetPetById -OrderId "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } Context 'Get-PSInventory' { It 'Test Get-PSInventory' { #$TestResult = Invoke-PetApiGetPetById - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } Context 'Get-PSOrderById' { It 'Test Get-PSOrderById' { #$TestResult = Invoke-PetApiGetPetById -OrderId "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } Context 'Invoke-PSPlaceOrder' { It 'Test Invoke-PSPlaceOrder' { #$TestResult = Invoke-PetApiGetPetById -Order "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } diff --git a/samples/client/petstore/powershell/tests/Api/PSUserApi.Tests.ps1 b/samples/client/petstore/powershell/tests/Api/PSUserApi.Tests.ps1 index 757592bd9322..6a7f50b9f57e 100644 --- a/samples/client/petstore/powershell/tests/Api/PSUserApi.Tests.ps1 +++ b/samples/client/petstore/powershell/tests/Api/PSUserApi.Tests.ps1 @@ -5,68 +5,68 @@ # Generated by OpenAPI Generator: https://openapi-generator.tech # -Describe -tag 'PSPetstore' -name 'PSUserApi' { +Describe -tag 'PSPetstore' -name 'PSPSUserApi' { Context 'New-PSUser' { It 'Test New-PSUser' { #$TestResult = Invoke-PetApiGetPetById -User "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } Context 'New-PSUsersWithArrayInput' { It 'Test New-PSUsersWithArrayInput' { #$TestResult = Invoke-PetApiGetPetById -User "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } Context 'New-PSUsersWithListInput' { It 'Test New-PSUsersWithListInput' { #$TestResult = Invoke-PetApiGetPetById -User "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } Context 'Remove-PSUser' { It 'Test Remove-PSUser' { #$TestResult = Invoke-PetApiGetPetById -Username "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } Context 'Get-PSUserByName' { It 'Test Get-PSUserByName' { #$TestResult = Invoke-PetApiGetPetById -Username "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } Context 'Invoke-PSLoginUser' { It 'Test Invoke-PSLoginUser' { #$TestResult = Invoke-PetApiGetPetById -Username "TEST_VALUE" -Password "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } Context 'Invoke-PSLogoutUser' { It 'Test Invoke-PSLogoutUser' { #$TestResult = Invoke-PetApiGetPetById - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } Context 'Update-PSUser' { It 'Test Update-PSUser' { #$TestResult = Invoke-PetApiGetPetById -Username "TEST_VALUE" -User "TEST_VALUE" - #$TestResult | Should BeOfType TODO - #$TestResult.property | Should Be 0 + #$TestResult | Should -BeOfType TODO + #$TestResult.property | Should -Be 0 } } diff --git a/samples/client/petstore/powershell/tests/Model/ApiResponse.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/ApiResponse.Tests.ps1 index e0c9985b2d98..792526347142 100644 --- a/samples/client/petstore/powershell/tests/Model/ApiResponse.Tests.ps1 +++ b/samples/client/petstore/powershell/tests/Model/ApiResponse.Tests.ps1 @@ -10,8 +10,8 @@ Describe -tag 'PSPetstore' -name 'PSApiResponse' { It 'Initialize-PSApiResponse' { # a simple test to create an object #$NewObject = Initialize-PSApiResponse -Code "TEST_VALUE" -Type "TEST_VALUE" -Message "TEST_VALUE" - #$NewObject | Should BeOfType ApiResponse - #$NewObject.property | Should Be 0 + #$NewObject | Should -BeOfType ApiResponse + #$NewObject.property | Should -Be 0 } } } diff --git a/samples/client/petstore/powershell/tests/Model/Category.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Category.Tests.ps1 index b405e070643d..b4782f412b40 100644 --- a/samples/client/petstore/powershell/tests/Model/Category.Tests.ps1 +++ b/samples/client/petstore/powershell/tests/Model/Category.Tests.ps1 @@ -10,8 +10,8 @@ Describe -tag 'PSPetstore' -name 'PSCategory' { It 'Initialize-PSCategory' { # a simple test to create an object #$NewObject = Initialize-PSCategory -Id "TEST_VALUE" -Name "TEST_VALUE" - #$NewObject | Should BeOfType Category - #$NewObject.property | Should Be 0 + #$NewObject | Should -BeOfType Category + #$NewObject.property | Should -Be 0 } } } diff --git a/samples/client/petstore/powershell/tests/Model/InlineObject.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/InlineObject.Tests.ps1 index aa18bd03aad7..ff544575a276 100644 --- a/samples/client/petstore/powershell/tests/Model/InlineObject.Tests.ps1 +++ b/samples/client/petstore/powershell/tests/Model/InlineObject.Tests.ps1 @@ -10,8 +10,8 @@ Describe -tag 'PSPetstore' -name 'PSInlineObject' { It 'Initialize-PSInlineObject' { # a simple test to create an object #$NewObject = Initialize-PSInlineObject -Name "TEST_VALUE" -Status "TEST_VALUE" - #$NewObject | Should BeOfType InlineObject - #$NewObject.property | Should Be 0 + #$NewObject | Should -BeOfType InlineObject + #$NewObject.property | Should -Be 0 } } } diff --git a/samples/client/petstore/powershell/tests/Model/InlineObject1.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/InlineObject1.Tests.ps1 index 1435f1826f49..01af66de6465 100644 --- a/samples/client/petstore/powershell/tests/Model/InlineObject1.Tests.ps1 +++ b/samples/client/petstore/powershell/tests/Model/InlineObject1.Tests.ps1 @@ -10,8 +10,8 @@ Describe -tag 'PSPetstore' -name 'PSInlineObject1' { It 'Initialize-PSInlineObject1' { # a simple test to create an object #$NewObject = Initialize-PSInlineObject1 -AdditionalMetadata "TEST_VALUE" -File "TEST_VALUE" - #$NewObject | Should BeOfType InlineObject1 - #$NewObject.property | Should Be 0 + #$NewObject | Should -BeOfType InlineObject1 + #$NewObject.property | Should -Be 0 } } } diff --git a/samples/client/petstore/powershell/tests/Model/Order.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Order.Tests.ps1 index 2c24df69c58a..5bf036e01fa2 100644 --- a/samples/client/petstore/powershell/tests/Model/Order.Tests.ps1 +++ b/samples/client/petstore/powershell/tests/Model/Order.Tests.ps1 @@ -10,8 +10,8 @@ Describe -tag 'PSPetstore' -name 'PSOrder' { It 'Initialize-PSOrder' { # a simple test to create an object #$NewObject = Initialize-PSOrder -Id "TEST_VALUE" -PetId "TEST_VALUE" -Quantity "TEST_VALUE" -ShipDate "TEST_VALUE" -Status "TEST_VALUE" -Complete "TEST_VALUE" - #$NewObject | Should BeOfType Order - #$NewObject.property | Should Be 0 + #$NewObject | Should -BeOfType Order + #$NewObject.property | Should -Be 0 } } } diff --git a/samples/client/petstore/powershell/tests/Model/Pet.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Pet.Tests.ps1 index 5cfcdc67e83b..1f6e189b8365 100644 --- a/samples/client/petstore/powershell/tests/Model/Pet.Tests.ps1 +++ b/samples/client/petstore/powershell/tests/Model/Pet.Tests.ps1 @@ -10,8 +10,8 @@ Describe -tag 'PSPetstore' -name 'PSPet' { It 'Initialize-PSPet' { # a simple test to create an object #$NewObject = Initialize-PSPet -Id "TEST_VALUE" -Category "TEST_VALUE" -Name "TEST_VALUE" -PhotoUrls "TEST_VALUE" -Tags "TEST_VALUE" -Status "TEST_VALUE" - #$NewObject | Should BeOfType Pet - #$NewObject.property | Should Be 0 + #$NewObject | Should -BeOfType Pet + #$NewObject.property | Should -Be 0 } } } diff --git a/samples/client/petstore/powershell/tests/Model/Tag.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/Tag.Tests.ps1 index d2e0b2203800..ae168f27dc79 100644 --- a/samples/client/petstore/powershell/tests/Model/Tag.Tests.ps1 +++ b/samples/client/petstore/powershell/tests/Model/Tag.Tests.ps1 @@ -10,8 +10,8 @@ Describe -tag 'PSPetstore' -name 'PSTag' { It 'Initialize-PSTag' { # a simple test to create an object #$NewObject = Initialize-PSTag -Id "TEST_VALUE" -Name "TEST_VALUE" - #$NewObject | Should BeOfType Tag - #$NewObject.property | Should Be 0 + #$NewObject | Should -BeOfType Tag + #$NewObject.property | Should -Be 0 } } } diff --git a/samples/client/petstore/powershell/tests/Model/User.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/User.Tests.ps1 index 2919e4adb4bb..1c9f4d6dee40 100644 --- a/samples/client/petstore/powershell/tests/Model/User.Tests.ps1 +++ b/samples/client/petstore/powershell/tests/Model/User.Tests.ps1 @@ -10,8 +10,8 @@ Describe -tag 'PSPetstore' -name 'PSUser' { It 'Initialize-PSUser' { # a simple test to create an object #$NewObject = Initialize-PSUser -Id "TEST_VALUE" -Username "TEST_VALUE" -FirstName "TEST_VALUE" -LastName "TEST_VALUE" -Email "TEST_VALUE" -Password "TEST_VALUE" -Phone "TEST_VALUE" -UserStatus "TEST_VALUE" - #$NewObject | Should BeOfType User - #$NewObject.property | Should Be 0 + #$NewObject | Should -BeOfType User + #$NewObject.property | Should -Be 0 } } } diff --git a/samples/client/petstore/powershell/tests/Petstore.Tests.ps1 b/samples/client/petstore/powershell/tests/Petstore.Tests.ps1 index cfcb506984d2..09e8b9a77717 100644 --- a/samples/client/petstore/powershell/tests/Petstore.Tests.ps1 +++ b/samples/client/petstore/powershell/tests/Petstore.Tests.ps1 @@ -23,21 +23,21 @@ Describe -tag 'PSOpenAPITools' -name 'Integration Tests' { # Get $Result = Get-PSPetById -petId $Id - $Result."id" | Should Be 38369 - $Result."name" | Should Be "PowerShell" - $Result."status" | Should Be "Available" - $Result."category"."id" | Should Be $Id - $Result."category"."name" | Should Be 'PSCategory' + $Result."id" | Should -Be 38369 + $Result."name" | Should -Be "PowerShell" + $Result."status" | Should -Be "Available" + $Result."category"."id" | Should -Be $Id + $Result."category"."name" | Should -Be 'PSCategory' - $Result.GetType().fullname | Should Be "System.Management.Automation.PSCustomObject" + $Result.GetType().fullname | Should -Be "System.Management.Automation.PSCustomObject" # Update (form) $Result = Update-PSPetWithForm -petId $Id -Name "PowerShell Update" -Status "Pending" $Result = Get-PSPetById -petId $Id - $Result."id" | Should Be 38369 - $Result."name" | Should Be "PowerShell Update" - $Result."status" | Should Be "Pending" + $Result."id" | Should -Be 38369 + $Result."name" | Should -Be "PowerShell Update" + $Result."status" | Should -Be "Pending" # Update (put) $NewPet = Initialize-PSPet -Id $Id -Name 'PowerShell2' -Category ( @@ -51,13 +51,13 @@ Describe -tag 'PSOpenAPITools' -name 'Integration Tests' { $Result = Update-PSPet -Pet $NewPet $Result = Get-PSPetById -petId $Id -WithHttpInfo - $Result.GetType().fullname | Should Be "System.Collections.Hashtable" - #$Result["Response"].GetType().fullanme | Should Be "System.Management.Automation.PSCustomObject" - $Result["Response"]."id" | Should Be 38369 - $Result["Response"]."name" | Should Be "PowerShell2" - $Result["Response"]."status" | Should Be "Sold" - $Result["StatusCode"] | Should Be 200 - $Result["Headers"]["Content-Type"] | Should Be "application/json" + $Result.GetType().fullname | Should -Be "System.Collections.Hashtable" + #$Result["Response"].GetType().fullanme | Should -Be "System.Management.Automation.PSCustomObject" + $Result["Response"]."id" | Should -Be 38369 + $Result["Response"]."name" | Should -Be "PowerShell2" + $Result["Response"]."status" | Should -Be "Sold" + $Result["StatusCode"] | Should -Be 200 + $Result["Headers"]["Content-Type"] | Should -Be "application/json" # upload file $file = Get-Item "./plus.gif" @@ -72,8 +72,8 @@ Describe -tag 'PSOpenAPITools' -name 'Integration Tests' { $Result = Update-PSPet -Pet $NewPet $Result = Get-PSPetById -petId $NewPet."id" -WithHttpInfo - $Result["Response"]."id" | Should Be $NewPet."id" - $Result["Response"]."name" | Should Be $NewPet."name" + $Result["Response"]."id" | Should -Be $NewPet."id" + $Result["Response"]."name" | Should -Be $NewPet."name" # Delete $Result = Remove-Pet -petId $Id @@ -109,19 +109,19 @@ Describe -tag 'PSOpenAPITools' -name 'Integration Tests' { # test find pets by tags $Results = Find-PSPetsByTags 'bazbaz' - $Results.GetType().FullName| Should Be "System.Object[]" - $Results.Count | Should Be 2 + $Results.GetType().FullName| Should -Be "System.Object[]" + $Results.Count | Should -Be 2 if ($Results[0]."id" -gt 10129) { - $Results[0]."id" | Should Be 20129 + $Results[0]."id" | Should -Be 20129 } else { - $Results[0]."id" | Should Be 10129 + $Results[0]."id" | Should -Be 10129 } if ($Results[1]."id" -gt 10129) { - $Results[1]."id" | Should Be 20129 + $Results[1]."id" | Should -Be 20129 } else { - $Results[1]."id" | Should Be 10129 + $Results[1]."id" | Should -Be 10129 } } @@ -132,22 +132,22 @@ Describe -tag 'PSOpenAPITools' -name 'Integration Tests' { $HS = Get-PSHostSetting - $HS[0]["Url"] | Should Be "http://{server}.swagger.io:{port}/v2" - $HS[0]["Description"] | Should Be "petstore server" - $HS[0]["Variables"]["server"]["Description"] | Should Be "No description provided" - $HS[0]["Variables"]["server"]["DefaultValue"] | Should Be "petstore" - $HS[0]["Variables"]["server"]["EnumValues"] | Should Be @("petstore", + $HS[0]["Url"] | Should -Be "http://{server}.swagger.io:{port}/v2" + $HS[0]["Description"] | Should -Be "petstore server" + $HS[0]["Variables"]["server"]["Description"] | Should -Be "No description provided" + $HS[0]["Variables"]["server"]["DefaultValue"] | Should -Be "petstore" + $HS[0]["Variables"]["server"]["EnumValues"] | Should -Be @("petstore", "qa-petstore", "dev-petstore") } It "Get-PSUrlFromHostSetting tests" { - Get-PSUrlFromHostSetting -Index 0 | Should Be "http://petstore.swagger.io:80/v2" - Get-PSUrlFromHostSetting -Index 0 -Variables @{ "port" = "8080" } | Should Be "http://petstore.swagger.io:8080/v2" + Get-PSUrlFromHostSetting -Index 0 | Should -Be "http://petstore.swagger.io:80/v2" + Get-PSUrlFromHostSetting -Index 0 -Variables @{ "port" = "8080" } | Should -Be "http://petstore.swagger.io:8080/v2" #Get-PSUrlFromHostSetting -Index 2 | Should -Throw -ExceptionType ([RuntimeException]) - #Get-PSUrlFromHostSetting -Index 2 -ErrorAction Stop | Should -Throw "RuntimeException: Invalid index 2 when selecting the host. Must be less than 2" - #Get-PSUrlFromHostSetting -Index 0 -Variables @{ "port" = "1234" } -ErrorAction Stop | Should -Throw "RuntimeException: The variable 'port' in the host URL has invalid value 1234. Must be 80,8080" + #Get-PSUrlFromHostSetting -Index 2 -ErrorAction Stop | Should -Throw "RuntimeException: Invalid index 2 when selecting the host. Must -Be less than 2" + #Get-PSUrlFromHostSetting -Index 0 -Variables @{ "port" = "1234" } -ErrorAction Stop | Should -Throw "RuntimeException: The variable 'port' in the host URL has invalid value 1234. Must -Be 80,8080" } @@ -156,16 +156,16 @@ Describe -tag 'PSOpenAPITools' -name 'Integration Tests' { Set-PSConfigurationDefaultHeader -Key "TestKey" -Value "TestValue" $Configuration = Get-PSConfiguration - $Configuration["DefaultHeaders"].Count | Should Be 1 - $Configuration["DefaultHeaders"]["TestKey"] | Should Be "TestValue" + $Configuration["DefaultHeaders"].Count | Should -Be 1 + $Configuration["DefaultHeaders"]["TestKey"] | Should -Be "TestValue" } It "Configuration tests" { $Conf = Get-PSConfiguration - $Conf["SkipCertificateCheck"] | Should Be $false + $Conf["SkipCertificateCheck"] | Should -Be $false $Conf = Set-PSConfiguration -PassThru -SkipCertificateCheck - $Conf["SkipCertificateCheck"] | Should Be $true + $Conf["SkipCertificateCheck"] | Should -Be $true $Conf = Set-PSConfiguration -PassThru # reset SkipCertificateCheck } @@ -179,10 +179,10 @@ Describe -tag 'PSOpenAPITools' -name 'Integration Tests' { It "Create Object from JSON tests" { $Result = ConvertFrom-PSJsonToPet '{"id": 345, "name": "json name test", "status": "available", "photoUrls": ["https://photo.test"]}' - $Result."id" | Should Be 345 - $Result."name" | Should Be "json name test" - $Result."status" | Should Be "available" - $Result."photoUrls" | Should Be @("https://photo.test") + $Result."id" | Should -Be 345 + $Result."name" | Should -Be "json name test" + $Result."status" | Should -Be "available" + $Result."photoUrls" | Should -Be @("https://photo.test") } }