diff --git a/.github/instructions/ci--workflows.instructions.md b/.github/instructions/ci--workflows.instructions.md index 47862e1..5a00564 100644 --- a/.github/instructions/ci--workflows.instructions.md +++ b/.github/instructions/ci--workflows.instructions.md @@ -30,8 +30,8 @@ Triggers on push/PR touching `Doc/**`, `Samples/**`, `.github/copilot-instructions.md`, `.claude/**`, `AGENTS.md`, `CLAUDE.md`, or the workflow file itself. Parallel jobs (no `needs:` dependency between them): -- **`anonymization`**: installs Pester 5.3+, runs `TestAnonymization.Tests.ps1`, throws on failure. -- **`ai-instructions`**: installs Pester 5.3+, runs `TestAiInstructions.Tests.ps1`, throws on +- **`anonymization`**: installs Pester 6.0+, runs `TestAnonymization.Tests.ps1`, throws on failure. +- **`ai-instructions`**: installs Pester 6.0+, runs `TestAiInstructions.Tests.ps1`, throws on failure. No build, no live server. Runs on `ubuntu-latest` to keep it fast and free of Windows-only overhead. diff --git a/.github/instructions/source-cmdlets--pester.instructions.md b/.github/instructions/source-cmdlets--pester.instructions.md index 41bd2f7..b5c2c6e 100644 --- a/.github/instructions/source-cmdlets--pester.instructions.md +++ b/.github/instructions/source-cmdlets--pester.instructions.md @@ -5,7 +5,7 @@ description: "How ISHRemote Pester (*.Tests.ps1) acceptance tests are structured # ISHRemote Pester Test Conventions -These are **Pester 5.3+ acceptance/integration tests** that run against a **live Tridion Docs +These are **Pester 6.0+ acceptance/integration tests** that run against a **live Tridion Docs (InfoShare) tenant**. They are not unit tests — almost every `It` makes real Web Services API calls, creates server objects, asserts, and then deletes them. Keep new tests consistent with the patterns below or you will create flaky runs for everyone. diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 99475cc..54c24fb 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -48,9 +48,9 @@ jobs: - name: Pester Test Anonymization (no live server needed) shell: pwsh run: | - if (-not (Get-Module -ListAvailable -Name Pester | Where-Object { $_.Version -ge [version]'5.3.0' })) { + if (-not (Get-Module -ListAvailable -Name Pester | Where-Object { $_.Version -ge [version]'6.0.0' })) { Set-PSRepository PSGallery -InstallationPolicy Trusted - Install-Module Pester -MinimumVersion 5.3.0 -Force -SkipPublisherCheck -Scope CurrentUser + Install-Module Pester -MinimumVersion 6.0.0 -Force -SkipPublisherCheck -Scope CurrentUser } $result = Invoke-Pester -Path Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestAnonymization.Tests.ps1 -Output Detailed -PassThru if ($result.FailedCount -gt 0) { @@ -65,9 +65,9 @@ jobs: - name: Pester Test AI Instructions (no live server needed) shell: pwsh run: | - if (-not (Get-Module -ListAvailable -Name Pester | Where-Object { $_.Version -ge [version]'5.3.0' })) { + if (-not (Get-Module -ListAvailable -Name Pester | Where-Object { $_.Version -ge [version]'6.0.0' })) { Set-PSRepository PSGallery -InstallationPolicy Trusted - Install-Module Pester -MinimumVersion 5.3.0 -Force -SkipPublisherCheck -Scope CurrentUser + Install-Module Pester -MinimumVersion 6.0.0 -Force -SkipPublisherCheck -Scope CurrentUser } $result = Invoke-Pester -Path Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestAiInstructions.Tests.ps1 -Output Detailed -PassThru if ($result.FailedCount -gt 0) { diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 5164183..5a8c446 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -82,16 +82,14 @@ jobs: shell: pwsh run: dotnet build --no-restore --no-incremental --configuration release Source/ISHRemote/ISHRemote.sln - - name: Setup PowerShell modules (PSScriptAnalyzer + Pester) + - name: Module Setup using PowerShell 7.x (PSScriptAnalyzer + Pester) shell: pwsh run: | Set-PSRepository PSGallery -InstallationPolicy Trusted Install-Module PSScriptAnalyzer -ErrorAction Stop - if (-not (Get-Module -ListAvailable -Name Pester | Where-Object { $_.Version -ge [version]'5.3.0' })) { - Install-Module Pester -MinimumVersion 5.3.0 -Force -SkipPublisherCheck -Scope CurrentUser - } + Install-Module Pester -MinimumVersion 6.0.0 -Force -SkipPublisherCheck -Scope CurrentUser - - name: Lint with PSScriptAnalyzer + - name: Lint with PSScriptAnalyzer using PowerShell 7.x shell: pwsh run: | Invoke-ScriptAnalyzer -Path Source/ISHRemote/Trisoft.ISHRemote/Scripts -Recurse -Outvariable issues @@ -103,9 +101,10 @@ jobs: Write-Output "There were $($errors.Count) errors and $($warnings.Count) warnings total." } - - name: Pester Test Anonymization of public Doc and Samples on Windows using PowerShell 7.x + - name: Pester Test Anonymization of public Doc and Samples using PowerShell 7.x shell: pwsh run: | + Import-Module Pester -MinimumVersion 6.0.0 -Force $result = Invoke-Pester -Path Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestAnonymization.Tests.ps1 -Output Detailed -PassThru if ($result.FailedCount -gt 0) { throw "Anonymization guard failed: $($result.FailedCount) check(s) found a real URL, internal hostname, private IP or token. Use example.com placeholders or extend the known-exceptions list in the test." @@ -145,7 +144,13 @@ jobs: name: ISHRemote-MainCI-Module path: Source/ISHRemote/Trisoft.ISHRemote/bin/Release/ISHRemote/ - - name: Pester Test Preparation (...products.com) on Windows using PowerShell 7.x + - name: Module Setup on PowerShell 7.x (Pester) + shell: pwsh + run: | + Set-PSRepository PSGallery -InstallationPolicy Trusted + Install-Module Pester -MinimumVersion 6.0.0 -Force -SkipPublisherCheck -Scope CurrentUser + + - name: Pester Test Preparation (...products.com) on PowerShell 7.x shell: pwsh env: ISH_BASE_URL: ${{ secrets.ISH_BASE_URL }} @@ -168,7 +173,7 @@ jobs: Add-Content -Path $filePath -Value ' $ishLngCombination = ''en-us''' Add-Content -Path $filePath -Value '}' - - name: Pester Test Prerequisites on Windows using PowerShell 7.x + - name: Pester Test Prerequisites on PowerShell 7.x shell: pwsh env: ISH_BASE_URL: ${{ secrets.ISH_BASE_URL }} @@ -176,14 +181,16 @@ jobs: ISH_PASSWORD: ${{ secrets.ISH_PASSWORD }} ISH_CLIENT_ID: ${{ secrets.ISH_CLIENT_ID }} ISH_CLIENT_SECRET: ${{ secrets.ISH_CLIENT_SECRET }} - run: Invoke-Pester -Path Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestPrerequisite.Tests.ps1 -Output Detailed -Passthru | Export-CliXml -Path Cmdlets.Pester.Tests.xml + run: | + Import-Module Pester -MinimumVersion 6.0.0 -Force + Invoke-Pester -Path Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestPrerequisite.Tests.ps1 -Output Detailed -Passthru | Export-CliXml -Path Cmdlets.Pester.Tests.xml - name: Upload test results uses: actions/upload-artifact@v7 with: name: ISHRemote-MainCI-PesterPrerequisiteOnPowerShellCore path: Cmdlets.Pester.Tests.xml - - name: Pester Test Cmdlets on Windows using PowerShell 7.x + - name: Pester Test Cmdlets on PowerShell 7.x shell: pwsh env: ISH_BASE_URL: ${{ secrets.ISH_BASE_URL }} @@ -191,7 +198,15 @@ jobs: ISH_PASSWORD: ${{ secrets.ISH_PASSWORD }} ISH_CLIENT_ID: ${{ secrets.ISH_CLIENT_ID }} ISH_CLIENT_SECRET: ${{ secrets.ISH_CLIENT_SECRET }} - run: Invoke-Pester -Path @('Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/','Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/') -ExcludePath @('*GetIshDocumentObj.Tests.ps1','*TestAnonymization.Tests.ps1') -Output Detailed -Passthru | Export-CliXml -Path Cmdlets.Pester.Tests.xml + run: | + Import-Module Pester -MinimumVersion 6.0.0 -Force + $config = New-PesterConfiguration + $config.Run.Path = @('Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/','Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/') + $config.Run.ExcludePath = @('*TestPrerequisite.Tests.ps1','*TestAnonymization.Tests.ps1') + $config.Run.Parallel = $false # can be $true on PS7, will run serially on PS5.1 + $config.Output.Verbosity = 'Detailed' + $config.Run.PassThru = $true + Invoke-Pester -Configuration $config | Export-CliXml -Path Cmdlets.Pester.Tests.xml - name: Upload test results uses: actions/upload-artifact@v7 with: @@ -199,7 +214,13 @@ jobs: path: Cmdlets.Pester.Tests.xml if: ${{ always() }} - - name: Pester Test Preparation (...products.com) using Windows PowerShell 5.1 + - name: Module Setup on Windows PowerShell 5.1 (Pester) + shell: powershell + run: | + Set-PSRepository PSGallery -InstallationPolicy Trusted + Install-Module Pester -MinimumVersion 6.0.0 -Force -SkipPublisherCheck -Scope CurrentUser + + - name: Pester Test Preparation (...products.com) on Windows PowerShell 5.1 shell: powershell env: ISH_BASE_URL: ${{ secrets.ISH_BASE_URL }} @@ -222,7 +243,7 @@ jobs: Add-Content -Path $filePath -Value ' $ishLngCombination = ''en-us''' Add-Content -Path $filePath -Value '}' - - name: Pester Test Prerequisites using Windows PowerShell 5.1 + - name: Pester Test Prerequisites on Windows PowerShell 5.1 shell: powershell env: ISH_BASE_URL: ${{ secrets.ISH_BASE_URL }} @@ -230,14 +251,16 @@ jobs: ISH_PASSWORD: ${{ secrets.ISH_PASSWORD }} ISH_CLIENT_ID: ${{ secrets.ISH_CLIENT_ID }} ISH_CLIENT_SECRET: ${{ secrets.ISH_CLIENT_SECRET }} - run: Invoke-Pester -Path Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestPrerequisite.Tests.ps1 -Output Detailed -Passthru | Export-CliXml -Path Cmdlets.Pester.Tests.xml + run: | + Import-Module Pester -MinimumVersion 6.0.0 -Force + Invoke-Pester -Path Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestPrerequisite.Tests.ps1 -Output Detailed -Passthru | Export-CliXml -Path Cmdlets.Pester.Tests.xml - name: Upload test results uses: actions/upload-artifact@v7 with: name: ISHRemote-MainCI-PesterPrerequisiteOnWindowsPowerShell path: Cmdlets.Pester.Tests.xml - - name: Pester Test Cmdlets using Windows PowerShell 5.1 + - name: Pester Test Cmdlets on Windows PowerShell 5.1 shell: powershell env: ISH_BASE_URL: ${{ secrets.ISH_BASE_URL }} @@ -245,7 +268,15 @@ jobs: ISH_PASSWORD: ${{ secrets.ISH_PASSWORD }} ISH_CLIENT_ID: ${{ secrets.ISH_CLIENT_ID }} ISH_CLIENT_SECRET: ${{ secrets.ISH_CLIENT_SECRET }} - run: Invoke-Pester -Path @('Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/') -ExcludePath @('*GetIshDocumentObj.Tests.ps1','*TestAnonymization.Tests.ps1') -Output Detailed -Passthru | Export-CliXml -Path Cmdlets.Pester.Tests.xml + run: | + Import-Module Pester -MinimumVersion 6.0.0 -Force + $config = New-PesterConfiguration + $config.Run.Path = @('Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/','Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/') + $config.Run.ExcludePath = @('*TestPrerequisite.Tests.ps1','*TestAnonymization.Tests.ps1') + $config.Run.Parallel = $false # can be $true on PS7, will run serially on PS5.1 + $config.Output.Verbosity = 'Detailed' + $config.Run.PassThru = $true + Invoke-Pester -Configuration $config | Export-CliXml -Path Cmdlets.Pester.Tests.xml - name: Upload test results uses: actions/upload-artifact@v7 with: @@ -303,15 +334,4 @@ jobs: echo ("Found recent module[ISHRemote] of version["+($remoteModule.Version)+"]. Skipping publish of module with version[$fullVersion]!") } - - name: "Info: How to publish to Internal/Nexus Repositories" - shell: pwsh - run: | - echo "Either the steps below or in-house https://jenkins-docs.web.sdldev.net/job/Publish-ISHRemote/ job that downloads and publishes to Nexus" - echo "1. Login to Github, navigate to $env:ISHGITHUB_SERVER_URL/$env:ISHGITHUB_REPOSITORY/actions/runs/$env:ISHGITHUB_RUN_ID" - echo "2. Download ISHRemote-MainCI-Module artefact to C:\TEMP\ISHRemote\ISHRemote-MainCI-Module.zip" - echo "3. In a PowerShell Session..." - echo "3a. Remove-Item -Path C:\TEMP\ISHRemote\ToPublish -Recurse -Force" - echo "3b. Expand-Archive -Path C:\TEMP\ISHRemote\ISHRemote-MainCI-Module.zip -DestinationPath C:\TEMP\ISHRemote\ToPublish\ -Force" - echo "3c. Publish-Module -Path C:\TEMP\ISHRemote\ToPublish\ISHRemote.psd1 -Repository $psRepository -NuGetApiKey $nuGetApiKey -Force" - echo "3d. Find-Module -Name ISHRemote -Repository $psRepository -AllowPrerelease" diff --git a/AGENTS.md b/AGENTS.md index 1cdc93d..fb04064 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -30,11 +30,23 @@ C# classes; a few advanced functions are PowerShell scripts. Cmdlets follow `Ver ``` dotnet restore Source/ISHRemote/ISHRemote.sln ``` -2. **Build:** +2. **Build — local iteration (use this when making and verifying code changes):** + ``` + dotnet build --no-restore --no-incremental --configuration debug Source/ISHRemote/ISHRemote.sln + ``` + `ISHRemote.PesterSetup.ps1` loads `bin\debug\ISHRemote` locally (outside GitHub Actions) and + `bin\release\ISHRemote` in CI. Building `release` locally does **not** update what the tests + load — always build `debug` when iterating locally. + + > **Locked DLL:** If the debug build fails with a file-locked error on a `.dll` inside + > `bin\Debug\ISHRemote\`, a `powershell.exe` or `pwsh.exe` process has the module loaded. + > Close all PowerShell sessions that imported ISHRemote (including any running Pester test + > sessions), then retry the build. + +3. **Build — pre-PR validation (mirrors CI, catches warning regressions):** ``` dotnet build --no-restore --no-incremental --configuration release Source/ISHRemote/ISHRemote.sln ``` - - Use `Debug` for local iteration; tests load `bin\debug\ISHRemote` locally and `bin\release\ISHRemote` in CI. - **Release fails on any warning** (`TreatWarningsAsErrors=true`). Keep the tree warning-clean. - The `net48` target requires **both** `pwsh.exe` (PowerShell 7) and `powershell.exe` (Windows PowerShell 5.1). @@ -55,7 +67,7 @@ CI reports analyzer findings but does not fail the build on them. Still, keep `S Without a reachable server, most tests cannot pass. - **Build before testing.** Tests import the compiled module from `bin\debug\ISHRemote` (local) or `bin\release\ISHRemote` (CI). -- Use **Pester 5.3.0+**: `Install-Module -Name Pester -Force -SkipPublisherCheck`. +- Use **Pester 6.0.0+**: `Install-Module -Name Pester -Force -SkipPublisherCheck`. - **Run order (fast → broad), from repo root:** 1. `Invoke-Pester -Path Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestPrerequisite.Tests.ps1 -Output Detailed` 2. `Invoke-Pester -Path Source/ISHRemote/Trisoft.ISHRemote/Cmdlets// -Output Detailed` diff --git a/Doc/ReleaseNotes-ISHRemote-8.3.md b/Doc/ReleaseNotes-ISHRemote-8.3.md index ef876f5..040d4d4 100644 --- a/Doc/ReleaseNotes-ISHRemote-8.3.md +++ b/Doc/ReleaseNotes-ISHRemote-8.3.md @@ -26,6 +26,8 @@ The below text describes the delta compared to fielded release ISHRemote v8.2. ## Implementation Details * Fixed `Start-IshRemoteMcpServer` failing to connect on Windows with newer MCP clients (e.g. OpenCode 1.18.11, protocol `2025-11-25`) with errors `MCP error -32001: Request timed out` and `Failed to get tools`. Three root causes: (1) `initialize` requests with `"id":0` were silently dropped because PowerShell treats `0` as falsy; (2) `[Console]::InputEncoding` defaults to OEM code page (`ibm437`) when `pwsh.exe` is spawned with redirected stdio on Windows, causing `ReadLine()` to block forever on UTF-8 JSON — fixed by explicitly setting UTF-8 encoding and replacing `Console.Out` with an auto-flushing `StreamWriter` via `[Console]::SetOut()`; (3) `Register-IshRemoteMcpTool` emitted an invalid `type: "object"` field in `ToolAnnotations` and used string `"true"`/`"false"` instead of boolean `$true`/`$false` for hint values, causing strict MCP schema validation to reject the tools list. Server name updated from `"PowerShell MCP Server (Template)"` to `"ISHRemote MCP Server"` and version bumped to `0.3.0`. Also fixed the server looping forever on stdin EOF (orphaned `pwsh` processes) by breaking the while loop when `ReadLine()` returns `$null`. See #243 and #261. Thanks @ddemeyer +* Migrated all 58 `*.Tests.ps1` files from Pester v5 to Pester v6 (`Should -Be` to `Should-Be`, `Should -BeExactly` to `Should-BeString -CaseSensitive`, `Should -Not -BeNullOrEmpty` to `Should-NotBeNull`, `Should -Throw "msg"` to `Should-Throw -ExceptionMessage "msg"`, etc.). CI install gates updated to `-MinimumVersion 6.0.0`. Classic `Should -Not -Throw` retained as there is no `Should-NotThrow` equivalent in Pester 6. Hardened the library for parallel test execution by replacing the process-wide `TrisoftCmdletLogger` singleton with per-cmdlet `ILogger` routing and adding a double-checked lock on `IshSession._ishTypeFieldSetup` to eliminate Collection was modified races under `Run.Parallel = $true`. CI Pester invocations now use `New-PesterConfiguration` (with `Run.Parallel = $false`) so parallel mode can be toggled in one place when ready. See #242, #265, #266. + ## Breaking Changes - Cmdlets @@ -58,7 +60,7 @@ All cmdlets and business logic are fully compatible. ## Quality Assurance -Added more Invoke-Pester 5.7.1 Tests, see Github actions for the Windows PowerShell 5.1 and PowerShell 7.6+ hosts where +Added more Invoke-Pester 6.0.0 Tests, see Github actions for the Windows PowerShell 5.1 and PowerShell 7.6+ hosts where * the skipped are about SslPolicyErrors testing and `ISHRemoteMcpServer` is PowerShell 7+ only * the failed are about IMetadata bound fields (issue #58) @@ -80,3 +82,6 @@ Below is not an official performance compare, but a recurring thing noticed alon | ISHRemote 8.2.13523.0 | PowerShell 7.5.4 on .NET 9.0.10 | LEUDEVDDE...@15.3.0b2303 | Tests completed in 141.61s AND Tests Passed: 1128, Failed: 0, Skipped: 4, Inconclusive: 0, NotRun: 0 | | ISHRemote 8.2.13525.0 | Windows PowerShell 5.1 on .NET 4.8.1 | LEUDEVDDE...@15.3.0b2303 | Tests completed in 132.15s AND Tests Passed: 1087, Failed: 0, Skipped: 52, Inconclusive: 0, NotRun: 0 | | ISHRemote 8.2.13525.0 | PowerShell 7.6.0 on .NET 10.0.5 | LEUDEVDDE...@15.3.0b2303 | Tests completed in 139.45s AND Tests Passed: 1135, Failed: 0, Skipped: 4, Inconclusive: 0, NotRun: 0 | +| ISHRemote 8.3.14019.0 | Windows PowerShell 5.1 on .NET 4.8.1 | LEUDEVDDE...@15.3.0b3005 | Tests completed in 123.35s AND Tests Passed: 1260, Failed: 0, Skipped: 54, Inconclusive: 0, NotRun: 0 | +| ISHRemote 8.3.14019.0 | PowerShell 7.6.5 on .NET 10.0.11 | LEUDEVDDE...@15.3.0b3005 | Tests completed in 149.16s AND Tests Passed: 1310, Failed: 0, Skipped: 4, Inconclusive: 0, NotRun: 0 | +| ISHRemote 8.3.14019.0 | PowerShell 7.6.5 on .NET 10.0.11 | LEUDEVDDE...@15.3.0b3005 | Tests completed in 79.77s AND Tests Passed: 1270, Failed: 0, Skipped: 4, Inconclusive: 0, NotRun: 0 (`$config.Run.Parallel = $true`) | diff --git a/README.MD b/README.MD index 0cb7d93..1f073b0 100644 --- a/README.MD +++ b/README.MD @@ -91,7 +91,7 @@ Any feedback is welcome. Please log a GitHub issue, make sure you submit your ve ## Testing Standards -Initial testing was based on Pester 3.4.0 which came as part of Windows 10/2016, to introduce support for PowerShell 7+ we switched to Pester 5+ ([#115](https://github.com/RWS/ISHRemote/issues/115)|[#132](https://github.com/RWS/ISHRemote/issues/132)). To force an upgrade from pre-packaged Pester 3.4.0, have a look at [Pester Installation](https://pester.dev/docs/introduction/installation), although on most systems it comes down to +Initial testing was based on Pester 3.4.0 which came as part of Windows 10/2016, to introduce support for PowerShell 7+ we switched to Pester 5+ ([#115](https://github.com/RWS/ISHRemote/issues/115)|[#132](https://github.com/RWS/ISHRemote/issues/132)), and later upgraded to Pester 6+ ([#242](https://github.com/RWS/ISHRemote/issues/242)). To force an upgrade from pre-packaged Pester 3.4.0, have a look at [Pester Installation](https://pester.dev/docs/introduction/installation), although on most systems it comes down to `Install-Module -Name Pester -Force -SkipPublisherCheck`. * Most Pester tests are acceptance test, enriched which some unit tests where possible. * Using a central `ISHRemote.PesterSetup.ps1` (with optional `ISHRemote.PesterSetup.Debug.ps1` override) in all `*.Tests.ps1` to specify the variables (not initialization) consistently @@ -104,7 +104,7 @@ In `ISHRemote.PesterSetup.Debug.ps1` override the global variables used for test ## Release Build and Publish To PowerShell Gallery Rought steps to release... -1. Use Visual Studio to build a `Debug` build. Run an `Invoke-Pester` (minimally Pester v5.3.0) on `C:\GITHUB\ishremote\Source\ISHRemote\Trisoft.ISHRemote`. All steps should be green. +1. Use Visual Studio to build a `Debug` build. Run an `Invoke-Pester` (minimally Pester v6.0.0) on `C:\GITHUB\ishremote\Source\ISHRemote\Trisoft.ISHRemote`. All steps should be green. 1. Use Visual Studio to build a `Release` build. Change `C:\GITHUB\ISHRemote\Source\ISHRemote\Trisoft.ISHRemote\ISHRemote.PesterSetup.ps1` to forcefully load `\bin\release\` (instead of `\bin\debug\`). Run an `Invoke-Pester` on `C:\GITHUB\ishremote\Source\ISHRemote\Trisoft.ISHRemote`. All steps should be green. 1. The folder content of `C:\GITHUB\ISHRemote\Source\ISHRemote\Trisoft.ISHRemote\bin\Release\` will be published 1. Check all files, especially `Scripts` that you have all files. diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/AddIshAnnotation.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/AddIshAnnotation.Tests.ps1 index 9894915..e08f14b 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/AddIshAnnotation.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/AddIshAnnotation.Tests.ps1 @@ -60,46 +60,46 @@ Describe "Add-IshAnnotation" -Tags "Create" { $ishAnnotation = Add-IshAnnotation -IshSession $ishsession -Metadata $ishAnnotationMetadata } It "GetType().Name" { - $ishAnnotation.GetType().Name | Should -BeExactly "IshAnnotation" + $ishAnnotation.GetType().Name | Should-BeString -CaseSensitive "IshAnnotation" } It "ishAnnotation.IshField" { - $ishAnnotation.IshField | Should -Not -BeNullOrEmpty + $ishAnnotation.IshField | Should-NotBeNull } It "ishAnnotation.IshRef" { - $ishAnnotation.IshRef | Should -Not -BeNullOrEmpty + $ishAnnotation.IshRef | Should-NotBeNull } It "ishAnnotation.IshType" { - $ishAnnotation.IshType | Should -Not -BeNullOrEmpty + $ishAnnotation.IshType | Should-NotBeNull } It "ishAnnotation.ObjectRef" { - $ishAnnotation.ObjectRef | Should -Not -BeNullOrEmpty + $ishAnnotation.ObjectRef | Should-NotBeNull } It "ishAnnotation PubLogicalId" { - $ishAnnotation.fishpublogicalid_annotation_value | Should -BeExactly $ishObjectPub.IshRef + $ishAnnotation.fishpublogicalid_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.IshRef } It "ishAnnotation PubVersion" { - $ishAnnotation.fishpubversion_annotation_value | Should -BeExactly $ishObjectPub.version_version_value + $ishAnnotation.fishpubversion_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.version_version_value } It "ishAnnotation PubLng" { - $ishAnnotation.fishpublanguage_annotation_value | Should -BeExactly $ishObjectPub.fishpubsourcelanguages_version_value + $ishAnnotation.fishpublanguage_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.fishpubsourcelanguages_version_value } It "ishAnnotation RevisionId" { - $ishAnnotation.fishrevisionid_annotation_value | Should -BeExactly $revisionId + $ishAnnotation.fishrevisionid_annotation_value | Should-BeString -CaseSensitive $revisionId } It "ishAnnotation Address" { - $ishAnnotation.fishannotationaddress_annotation_value | Should -BeExactly $annotationAddress + $ishAnnotation.fishannotationaddress_annotation_value | Should-BeString -CaseSensitive $annotationAddress } It "ishAnnotation Text" { - $ishAnnotation.fishannotationtext_annotation_value | Should -BeExactly $annotationText + $ishAnnotation.fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationText } It "ishAnnotation Category" { - $ishAnnotation.fishannotationcategory_annotation_value | Should -BeExactly $annotationCategory + $ishAnnotation.fishannotationcategory_annotation_value | Should-BeString -CaseSensitive $annotationCategory } It "ishAnnotation Type" { - $ishAnnotation.fishannotationtype_annotation_value | Should -BeExactly $annotationType + $ishAnnotation.fishannotationtype_annotation_value | Should-BeString -CaseSensitive $annotationType } It "Metadata is null" { - {Add-IshAnnotation -IshSession $ishsession -Metadata $null} | Should -Throw + {Add-IshAnnotation -IshSession $ishsession -Metadata $null} | Should-Throw } } @@ -125,40 +125,40 @@ Describe "Add-IshAnnotation" -Tags "Create" { -Address $annotationAddress } It "ishAnnotation RevisionId" { - $ishAnnotation.fishrevisionid_annotation_value | Should -BeExactly $revisionId + $ishAnnotation.fishrevisionid_annotation_value | Should-BeString -CaseSensitive $revisionId } It "ishAnnotation PubLogicalId" { - $ishAnnotation.fishpublogicalid_annotation_value | Should -BeExactly $ishObjectPub.IshRef + $ishAnnotation.fishpublogicalid_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.IshRef } It "ishAnnotation PubVersion" { - $ishAnnotation.fishpubversion_annotation_value | Should -BeExactly $ishObjectPub.version_version_value + $ishAnnotation.fishpubversion_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.version_version_value } It "ishAnnotation PubLng" { - $ishAnnotation.fishpublanguage_annotation_value | Should -BeExactly $ishObjectPub.fishpubsourcelanguages_version_value + $ishAnnotation.fishpublanguage_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.fishpubsourcelanguages_version_value } It "ishAnnotation LogicalId" { - $ishAnnotation.fishcontentobjlogicalid_annotation_value | Should -BeExactly $ishObjectTopic.IshRef + $ishAnnotation.fishcontentobjlogicalid_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.IshRef } It "ishAnnotation Version" { - $ishAnnotation.fishcontentobjversion_annotation_value | Should -BeExactly $ishObjectTopic.version_version_value + $ishAnnotation.fishcontentobjversion_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.version_version_value } It "ishAnnotation Lng" { - $ishAnnotation.fishcontentobjlanguage_annotation_value | Should -BeExactly $ishObjectTopic.doclanguage + $ishAnnotation.fishcontentobjlanguage_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.doclanguage } It "ishAnnotation Status" { - $ishAnnotation.fishannotationstatus_annotation_value | Should -BeExactly $annotationStatus + $ishAnnotation.fishannotationstatus_annotation_value | Should-BeString -CaseSensitive $annotationStatus } It "ishAnnotation Address" { - $ishAnnotation.fishannotationaddress_annotation_value | Should -BeExactly $annotationAddress + $ishAnnotation.fishannotationaddress_annotation_value | Should-BeString -CaseSensitive $annotationAddress } It "ishAnnotation Text" { - $ishAnnotation.fishannotationtext_annotation_value | Should -BeExactly $annotationText + $ishAnnotation.fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationText } It "ishAnnotation Category" { - $ishAnnotation.fishannotationcategory_annotation_value | Should -BeExactly $annotationCategory + $ishAnnotation.fishannotationcategory_annotation_value | Should-BeString -CaseSensitive $annotationCategory } It "ishAnnotation Type" { - $ishAnnotation.fishannotationtype_annotation_value | Should -BeExactly $annotationType + $ishAnnotation.fishannotationtype_annotation_value | Should-BeString -CaseSensitive $annotationType } } @@ -199,43 +199,43 @@ Describe "Add-IshAnnotation" -Tags "Create" { -Metadata $metadataProvided } It "ishAnnotation Address" { - $ishAnnotation.fishannotationaddress_annotation_value | Should -BeExactly $annotationAddress + $ishAnnotation.fishannotationaddress_annotation_value | Should-BeString -CaseSensitive $annotationAddress } It "ishAnnotation Text" { - $ishAnnotation.fishannotationtext_annotation_value | Should -BeExactly $annotationText + $ishAnnotation.fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationText } It "ishAnnotation Category" { - $ishAnnotation.fishannotationcategory_annotation_value | Should -BeExactly $annotationCategory + $ishAnnotation.fishannotationcategory_annotation_value | Should-BeString -CaseSensitive $annotationCategory } It "ishAnnotation Type" { - $ishAnnotation.fishannotationtype_annotation_value | Should -BeExactly $annotationType + $ishAnnotation.fishannotationtype_annotation_value | Should-BeString -CaseSensitive $annotationType } It "ishAnnotation Status" { - $ishAnnotation.fishannotationstatus_annotation_value | Should -BeExactly $annotationStatus + $ishAnnotation.fishannotationstatus_annotation_value | Should-BeString -CaseSensitive $annotationStatus } It "ishAnnotation PublogicalId" { - $ishAnnotation.fishpublogicalid_annotation_value | Should -BeExactly $ishObjectPub.IshRef + $ishAnnotation.fishpublogicalid_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.IshRef } It "ishAnnotation PubVersion" { - $ishAnnotation.fishpubversion_annotation_value | Should -BeExactly $ishObjectPub.version_version_value + $ishAnnotation.fishpubversion_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.version_version_value } It "ishAnnotation PubLng" { - $ishAnnotation.fishpublanguage_annotation_value | Should -BeExactly $ishObjectPub.fishpubsourcelanguages_version_value + $ishAnnotation.fishpublanguage_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.fishpubsourcelanguages_version_value } It "ishAnnotation RevisionId" { - $ishAnnotation.fishrevisionid_annotation_value | Should -BeExactly $revisionId + $ishAnnotation.fishrevisionid_annotation_value | Should-BeString -CaseSensitive $revisionId } It "ishAnnotation LogicalId" { - $ishAnnotation.fishcontentobjlogicalid_annotation_value | Should -BeExactly $ishObjectTopic.IshRef + $ishAnnotation.fishcontentobjlogicalid_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.IshRef } It "ishAnnotation Version" { - $ishAnnotation.fishcontentobjversion_annotation_value | Should -BeExactly $ishObjectTopic.version_version_value + $ishAnnotation.fishcontentobjversion_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.version_version_value } It "ishAnnotation Lng" { - $ishAnnotation.fishcontentobjlanguage_annotation_value | Should -BeExactly $ishObjectTopic.doclanguage + $ishAnnotation.fishcontentobjlanguage_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.doclanguage } It "ishAnnotation ProposedChngText" { - $ishAnnotation.fishannotproposedchngtxt_annotation_value | Should -BeExactly $proposedChangeText + $ishAnnotation.fishannotproposedchngtxt_annotation_value | Should-BeString -CaseSensitive $proposedChangeText } } @@ -259,40 +259,40 @@ Describe "Add-IshAnnotation" -Tags "Create" { -Address $annotationAddress } It "ishAnnotation RevisionId" { - $ishAnnotation.fishrevisionid_annotation_value | Should -BeExactly $revisionId + $ishAnnotation.fishrevisionid_annotation_value | Should-BeString -CaseSensitive $revisionId } It "ishAnnotation LogicalId" { - $ishAnnotation.fishcontentobjlogicalid_annotation_value | Should -BeExactly $ishObjectTopic.IshRef + $ishAnnotation.fishcontentobjlogicalid_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.IshRef } It "ishAnnotation Version" { - $ishAnnotation.fishcontentobjversion_annotation_value | Should -BeExactly $ishObjectTopic.version_version_value + $ishAnnotation.fishcontentobjversion_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.version_version_value } It "ishAnnotation Lng" { - $ishAnnotation.fishcontentobjlanguage_annotation_value | Should -BeExactly $ishObjectTopic.doclanguage + $ishAnnotation.fishcontentobjlanguage_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.doclanguage } It "ishAnnotation PublogicalId" { - $ishAnnotation.fishpublogicalid_annotation_value | Should -BeExactly $ishObjectPub.IshRef + $ishAnnotation.fishpublogicalid_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.IshRef } It "ishAnnotation PubVersion" { - $ishAnnotation.fishpubversion_annotation_value | Should -BeExactly $ishObjectPub.version_version_value + $ishAnnotation.fishpubversion_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.version_version_value } It "ishAnnotation PubLng" { - $ishAnnotation.fishpublanguage_annotation_value | Should -BeExactly $ishObjectPub.fishpubsourcelanguages_version_value + $ishAnnotation.fishpublanguage_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.fishpubsourcelanguages_version_value } It "ishAnnotation Status" { - $ishAnnotation.fishannotationstatus_annotation_value | Should -BeExactly $annotationStatus + $ishAnnotation.fishannotationstatus_annotation_value | Should-BeString -CaseSensitive $annotationStatus } It "ishAnnotation Address" { - $ishAnnotation.fishannotationaddress_annotation_value | Should -BeExactly $annotationAddress + $ishAnnotation.fishannotationaddress_annotation_value | Should-BeString -CaseSensitive $annotationAddress } It "ishAnnotation Text" { - $ishAnnotation.fishannotationtext_annotation_value | Should -BeExactly $annotationText + $ishAnnotation.fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationText } It "ishAnnotation Category" { - $ishAnnotation.fishannotationcategory_annotation_value | Should -BeExactly $annotationCategory + $ishAnnotation.fishannotationcategory_annotation_value | Should-BeString -CaseSensitive $annotationCategory } It "ishAnnotation Type" { - $ishAnnotation.fishannotationtype_annotation_value | Should -BeExactly $annotationType + $ishAnnotation.fishannotationtype_annotation_value | Should-BeString -CaseSensitive $annotationType } It "IshObject is of invalid type (IshPublication)" { {$ishAnnotation = Add-IshAnnotation -IshSession $ishsession ` @@ -305,7 +305,7 @@ Describe "Add-IshAnnotation" -Tags "Create" { -Status $annotationStatus ` -Category $annotationCategory ` -Address $annotationAddress - } | Should -Throw + } | Should-Throw } } @@ -343,43 +343,43 @@ Describe "Add-IshAnnotation" -Tags "Create" { -Metadata $metadataProvided } It "ishAnnotation RevisionId" { - $ishAnnotation.fishrevisionid_annotation_value | Should -BeExactly $revisionId + $ishAnnotation.fishrevisionid_annotation_value | Should-BeString -CaseSensitive $revisionId } It "ishAnnotation LogicalId" { - $ishAnnotation.fishcontentobjlogicalid_annotation_value | Should -BeExactly $ishObjectTopic.IshRef + $ishAnnotation.fishcontentobjlogicalid_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.IshRef } It "ishAnnotation Version" { - $ishAnnotation.fishcontentobjversion_annotation_value | Should -BeExactly $ishObjectTopic.version_version_value + $ishAnnotation.fishcontentobjversion_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.version_version_value } It "ishAnnotation Lng" { - $ishAnnotation.fishcontentobjlanguage_annotation_value | Should -BeExactly $ishObjectTopic.doclanguage + $ishAnnotation.fishcontentobjlanguage_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.doclanguage } It "ishAnnotation PublogicalId" { - $ishAnnotation.fishpublogicalid_annotation_value | Should -BeExactly $ishObjectPub.IshRef + $ishAnnotation.fishpublogicalid_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.IshRef } It "ishAnnotation PubVersion" { - $ishAnnotation.fishpubversion_annotation_value | Should -BeExactly $ishObjectPub.version_version_value + $ishAnnotation.fishpubversion_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.version_version_value } It "ishAnnotation PubLng" { - $ishAnnotation.fishpublanguage_annotation_value | Should -BeExactly $ishObjectPub.fishpubsourcelanguages_version_value + $ishAnnotation.fishpublanguage_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.fishpubsourcelanguages_version_value } It "ishAnnotation Status" { - $ishAnnotation.fishannotationstatus_annotation_value | Should -BeExactly $annotationStatus + $ishAnnotation.fishannotationstatus_annotation_value | Should-BeString -CaseSensitive $annotationStatus } It "ishAnnotation Address" { - $ishAnnotation.fishannotationaddress_annotation_value | Should -BeExactly $annotationAddress + $ishAnnotation.fishannotationaddress_annotation_value | Should-BeString -CaseSensitive $annotationAddress } It "ishAnnotation Text" { - $ishAnnotation.fishannotationtext_annotation_value | Should -BeExactly $annotationText + $ishAnnotation.fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationText } It "ishAnnotation Category" { - $ishAnnotation.fishannotationcategory_annotation_value | Should -BeExactly $annotationCategory + $ishAnnotation.fishannotationcategory_annotation_value | Should-BeString -CaseSensitive $annotationCategory } It "ishAnnotation Type" { - $ishAnnotation.fishannotationtype_annotation_value | Should -BeExactly $annotationType + $ishAnnotation.fishannotationtype_annotation_value | Should-BeString -CaseSensitive $annotationType } It "ishAnnotation ProposedChngText" { - $ishAnnotation.fishannotproposedchngtxt_annotation_value | Should -BeExactly $proposedChangeText + $ishAnnotation.fishannotproposedchngtxt_annotation_value | Should-BeString -CaseSensitive $proposedChangeText } } @@ -402,40 +402,40 @@ Describe "Add-IshAnnotation" -Tags "Create" { -Address $annotationAddress } It "ishAnnotation RevisionId" { - $ishAnnotation.fishrevisionid_annotation_value | Should -BeExactly $revisionId + $ishAnnotation.fishrevisionid_annotation_value | Should-BeString -CaseSensitive $revisionId } It "ishAnnotation LogicalId" { - $ishAnnotation.fishcontentobjlogicalid_annotation_value | Should -BeExactly $ishObjectTopic.IshRef + $ishAnnotation.fishcontentobjlogicalid_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.IshRef } It "ishAnnotation PublogicalId" { - $ishAnnotation.fishpublogicalid_annotation_value | Should -BeExactly $ishObjectPub.IshRef + $ishAnnotation.fishpublogicalid_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.IshRef } It "ishAnnotation PubVersion" { - $ishAnnotation.fishpubversion_annotation_value | Should -BeExactly $ishObjectPub.version_version_value + $ishAnnotation.fishpubversion_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.version_version_value } It "ishAnnotation PubLng" { - $ishAnnotation.fishpublanguage_annotation_value | Should -BeExactly $ishObjectPub.fishpubsourcelanguages_version_value + $ishAnnotation.fishpublanguage_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.fishpubsourcelanguages_version_value } It "ishAnnotation Version" { - $ishAnnotation.fishcontentobjversion_annotation_value | Should -BeExactly $ishObjectTopic.version_version_value + $ishAnnotation.fishcontentobjversion_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.version_version_value } It "ishAnnotation Lng" { - $ishAnnotation.fishcontentobjlanguage_annotation_value | Should -BeExactly $ishObjectTopic.doclanguage + $ishAnnotation.fishcontentobjlanguage_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.doclanguage } It "ishAnnotation Status" { - $ishAnnotation.fishannotationstatus_annotation_value | Should -BeExactly $annotationStatus + $ishAnnotation.fishannotationstatus_annotation_value | Should-BeString -CaseSensitive $annotationStatus } It "ishAnnotation Address" { - $ishAnnotation.fishannotationaddress_annotation_value | Should -BeExactly $annotationAddress + $ishAnnotation.fishannotationaddress_annotation_value | Should-BeString -CaseSensitive $annotationAddress } It "ishAnnotation Text" { - $ishAnnotation.fishannotationtext_annotation_value | Should -BeExactly $annotationText + $ishAnnotation.fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationText } It "ishAnnotation Category" { - $ishAnnotation.fishannotationcategory_annotation_value | Should -BeExactly $annotationCategory + $ishAnnotation.fishannotationcategory_annotation_value | Should-BeString -CaseSensitive $annotationCategory } It "ishAnnotation Type" { - $ishAnnotation.fishannotationtype_annotation_value | Should -BeExactly $annotationType + $ishAnnotation.fishannotationtype_annotation_value | Should-BeString -CaseSensitive $annotationType } } @@ -471,43 +471,43 @@ Describe "Add-IshAnnotation" -Tags "Create" { -IshAnnotation $ishAnnotation } It "ishAnnotation RevisionId" { - $ishAnnotationUpdated.fishrevisionid_annotation_value | Should -BeExactly $revisionId + $ishAnnotationUpdated.fishrevisionid_annotation_value | Should-BeString -CaseSensitive $revisionId } It "ishAnnotation LogicalId" { - $ishAnnotationUpdated.fishcontentobjlogicalid_annotation_value | Should -BeExactly $ishObjectTopic.IshRef + $ishAnnotationUpdated.fishcontentobjlogicalid_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.IshRef } It "ishAnnotation PublogicalId" { - $ishAnnotation.fishpublogicalid_annotation_value | Should -BeExactly $ishObjectPub.IshRef + $ishAnnotation.fishpublogicalid_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.IshRef } It "ishAnnotation PubVersion" { - $ishAnnotation.fishpubversion_annotation_value | Should -BeExactly $ishObjectPub.version_version_value + $ishAnnotation.fishpubversion_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.version_version_value } It "ishAnnotation PubLng" { - $ishAnnotation.fishpublanguage_annotation_value | Should -BeExactly $ishObjectPub.fishpubsourcelanguages_version_value + $ishAnnotation.fishpublanguage_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.fishpubsourcelanguages_version_value } It "ishAnnotation Version" { - $ishAnnotationUpdated.fishcontentobjversion_annotation_value | Should -BeExactly $ishObjectTopic.version_version_value + $ishAnnotationUpdated.fishcontentobjversion_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.version_version_value } It "ishAnnotation Lng" { - $ishAnnotationUpdated.fishcontentobjlanguage_annotation_value | Should -BeExactly $ishObjectTopic.doclanguage + $ishAnnotationUpdated.fishcontentobjlanguage_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.doclanguage } It "ishAnnotation Status" { - $ishAnnotationUpdated.fishannotationstatus_annotation_value | Should -BeExactly $annotationStatus + $ishAnnotationUpdated.fishannotationstatus_annotation_value | Should-BeString -CaseSensitive $annotationStatus } It "ishAnnotation Address" { - $ishAnnotationUpdated.fishannotationaddress_annotation_value | Should -BeExactly $annotationAddress + $ishAnnotationUpdated.fishannotationaddress_annotation_value | Should-BeString -CaseSensitive $annotationAddress } It "ishAnnotation Text" { - $ishAnnotationUpdated.fishannotationtext_annotation_value | Should -BeExactly $annotationTextUpdated + $ishAnnotationUpdated.fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationTextUpdated } It "ishAnnotation Category" { - $ishAnnotationUpdated.fishannotationcategory_annotation_value | Should -BeExactly $annotationCategory + $ishAnnotationUpdated.fishannotationcategory_annotation_value | Should-BeString -CaseSensitive $annotationCategory } It "ishAnnotation Type" { - $ishAnnotationUpdated.fishannotationtype_annotation_value | Should -BeExactly $annotationType + $ishAnnotationUpdated.fishannotationtype_annotation_value | Should-BeString -CaseSensitive $annotationType } It "ishAnnotation ProposedChngText" { - $ishAnnotationUpdated.fishannotproposedchngtxt_annotation_value | Should -BeExactly $proposedChangeTextUpdated + $ishAnnotationUpdated.fishannotproposedchngtxt_annotation_value | Should-BeString -CaseSensitive $proposedChangeTextUpdated } } @@ -556,49 +556,49 @@ Describe "Add-IshAnnotation" -Tags "Create" { $ishAnnotationsUpdated = @($ishAnnotation1, $ishAnnotation2) | Add-IshAnnotation -IshSession $ishsession } It "ishAnnotations array count" { - $ishAnnotationsUpdated.Count | Should -BeExactly 2 + $ishAnnotationsUpdated.Count | Should-Be 2 } foreach($ishAnnotationUpdated in $ishAnnotationsUpdated) { It "ishAnnotation RevisionId" { - $ishAnnotationUpdated.fishrevisionid_annotation_value | Should -BeExactly $revisionId + $ishAnnotationUpdated.fishrevisionid_annotation_value | Should-BeString -CaseSensitive $revisionId } It "ishAnnotation LogicalId" { - $ishAnnotationUpdated.fishcontentobjlogicalid_annotation_value | Should -BeExactly $ishObjectTopic.IshRef + $ishAnnotationUpdated.fishcontentobjlogicalid_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.IshRef } It "ishAnnotation Version" { - $ishAnnotationUpdated.fishcontentobjversion_annotation_value | Should -BeExactly $ishObjectTopic.version_version_value + $ishAnnotationUpdated.fishcontentobjversion_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.version_version_value } It "ishAnnotation Lng" { - $ishAnnotationUpdated.fishcontentobjlanguage_annotation_value | Should -BeExactly $ishObjectTopic.doclanguage + $ishAnnotationUpdated.fishcontentobjlanguage_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.doclanguage } It "ishAnnotation PublogicalId" { - $ishAnnotationUpdated.fishpublogicalid_annotation_value | Should -BeExactly $ishObjectPub.IshRef + $ishAnnotationUpdated.fishpublogicalid_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.IshRef } It "ishAnnotation PubVersion" { - $ishAnnotationUpdated.fishpubversion_annotation_value | Should -BeExactly $ishObjectPub.version_version_value + $ishAnnotationUpdated.fishpubversion_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.version_version_value } It "ishAnnotation PubLng" { - $ishAnnotationUpdated.fishpublanguage_annotation_value | Should -BeExactly $ishObjectPub.fishpubsourcelanguages_version_value + $ishAnnotationUpdated.fishpublanguage_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.fishpubsourcelanguages_version_value } It "ishAnnotation Status" { - $ishAnnotationUpdated.fishannotationstatus_annotation_value | Should -BeExactly $annotationStatus + $ishAnnotationUpdated.fishannotationstatus_annotation_value | Should-BeString -CaseSensitive $annotationStatus } It "ishAnnotation Address" { - $ishAnnotationUpdated.fishannotationaddress_annotation_value | Should -BeExactly $annotationAddress + $ishAnnotationUpdated.fishannotationaddress_annotation_value | Should-BeString -CaseSensitive $annotationAddress } It "ishAnnotation Text" { - $ishAnnotationUpdated.fishannotationtext_annotation_value | Should -BeExactly $annotationTextUpdated + $ishAnnotationUpdated.fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationTextUpdated } It "ishAnnotation Category" { - $ishAnnotationUpdated.fishannotationcategory_annotation_value | Should -BeExactly $annotationCategory + $ishAnnotationUpdated.fishannotationcategory_annotation_value | Should-BeString -CaseSensitive $annotationCategory } It "ishAnnotation Type" { - $ishAnnotationUpdated.fishannotationtype_annotation_value | Should -BeExactly $annotationType + $ishAnnotationUpdated.fishannotationtype_annotation_value | Should-BeString -CaseSensitive $annotationType } It "ishAnnotation ProposedChngText" { - $ishAnnotationUpdated.fishannotproposedchngtxt_annotation_value | Should -BeExactly $proposedChangeTextUpdated + $ishAnnotationUpdated.fishannotproposedchngtxt_annotation_value | Should-BeString -CaseSensitive $proposedChangeTextUpdated } } } @@ -633,43 +633,43 @@ Describe "Add-IshAnnotation" -Tags "Create" { $ishAnnotationUpdated = $ishAnnotation | Add-IshAnnotation -IshSession $ishsession } It "ishAnnotation RevisionId" { - $ishAnnotationUpdated.fishrevisionid_annotation_value | Should -BeExactly $revisionId + $ishAnnotationUpdated.fishrevisionid_annotation_value | Should-BeString -CaseSensitive $revisionId } It "ishAnnotation LogicalId" { - $ishAnnotationUpdated.fishcontentobjlogicalid_annotation_value | Should -BeExactly $ishObjectTopic.IshRef + $ishAnnotationUpdated.fishcontentobjlogicalid_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.IshRef } It "ishAnnotation Version" { - $ishAnnotationUpdated.fishcontentobjversion_annotation_value | Should -BeExactly $ishObjectTopic.version_version_value + $ishAnnotationUpdated.fishcontentobjversion_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.version_version_value } It "ishAnnotation Lng" { - $ishAnnotationUpdated.fishcontentobjlanguage_annotation_value | Should -BeExactly $ishObjectTopic.doclanguage + $ishAnnotationUpdated.fishcontentobjlanguage_annotation_value | Should-BeString -CaseSensitive $ishObjectTopic.doclanguage } It "ishAnnotation PublogicalId" { - $ishAnnotation.fishpublogicalid_annotation_value | Should -BeExactly $ishObjectPub.IshRef + $ishAnnotation.fishpublogicalid_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.IshRef } It "ishAnnotation PubVersion" { - $ishAnnotation.fishpubversion_annotation_value | Should -BeExactly $ishObjectPub.version_version_value + $ishAnnotation.fishpubversion_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.version_version_value } It "ishAnnotation PubLng" { - $ishAnnotation.fishpublanguage_annotation_value | Should -BeExactly $ishObjectPub.fishpubsourcelanguages_version_value + $ishAnnotation.fishpublanguage_annotation_value | Should-BeString -CaseSensitive $ishObjectPub.fishpubsourcelanguages_version_value } It "ishAnnotation Status" { - $ishAnnotationUpdated.fishannotationstatus_annotation_value | Should -BeExactly $annotationStatus + $ishAnnotationUpdated.fishannotationstatus_annotation_value | Should-BeString -CaseSensitive $annotationStatus } It "ishAnnotation Address" { - $ishAnnotationUpdated.fishannotationaddress_annotation_value | Should -BeExactly $annotationAddress + $ishAnnotationUpdated.fishannotationaddress_annotation_value | Should-BeString -CaseSensitive $annotationAddress } It "ishAnnotation Text" { - $ishAnnotationUpdated.fishannotationtext_annotation_value | Should -BeExactly $annotationTextUpdated + $ishAnnotationUpdated.fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationTextUpdated } It "ishAnnotation Category" { - $ishAnnotationUpdated.fishannotationcategory_annotation_value | Should -BeExactly $annotationCategory + $ishAnnotationUpdated.fishannotationcategory_annotation_value | Should-BeString -CaseSensitive $annotationCategory } It "ishAnnotation Type" { - $ishAnnotationUpdated.fishannotationtype_annotation_value | Should -BeExactly $annotationType + $ishAnnotationUpdated.fishannotationtype_annotation_value | Should-BeString -CaseSensitive $annotationType } It "ishAnnotation ProposedChngText" { - $ishAnnotationUpdated.fishannotproposedchngtxt_annotation_value | Should -BeExactly $proposedChangeTextUpdated + $ishAnnotationUpdated.fishannotproposedchngtxt_annotation_value | Should-BeString -CaseSensitive $proposedChangeTextUpdated } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/FindIshAnnotation.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/FindIshAnnotation.Tests.ps1 index 428bb7b..f57fe7d 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/FindIshAnnotation.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/FindIshAnnotation.Tests.ps1 @@ -94,17 +94,17 @@ Describe "Find-IshAnnotation" -Tags "Create" { $ishAnnotations = Find-IshAnnotation -IshSession $ishsession ` -RequestedMetadata $requestedMetadata ` -MetadataFilter $metadataFilter - $ishAnnotations.Count | Should -BeExactly 2 - $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should -Be $true - $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should -Be $true + $ishAnnotations.Count | Should-Be 2 + $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should-Be $true + $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should-Be $true } It "Find all annotations from Publication1 without RequestedMetadata" { $metadataFilter = Set-IshMetadataFilterField -IshSession $ishSession -Name FISHPUBLOGICALID -Level Annotation -FilterOperator Equal -Value $ishObjectPub1.IshRef $ishAnnotations = Find-IshAnnotation -IshSession $ishsession ` -MetadataFilter $metadataFilter - $ishAnnotations.Count | Should -BeExactly 2 - $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should -Be $true - $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should -Be $true + $ishAnnotations.Count | Should-Be 2 + $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should-Be $true + $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should-Be $true } It "Find only 1 annotation from Publication1" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "FISHANNOTATIONREPLIES" -Level Annotation @@ -113,16 +113,16 @@ Describe "Find-IshAnnotation" -Tags "Create" { $ishAnnotations = Find-IshAnnotation -IshSession $ishsession ` -RequestedMetadata $requestedMetadata ` -MetadataFilter $metadataFilter - $ishAnnotations.Count | Should -BeExactly 1 - $ishAnnotation1P1.IshRef | Should -BeExactly $ishAnnotations.IshRef + $ishAnnotations.Count | Should-Be 1 + $ishAnnotation1P1.IshRef | Should-BeString -CaseSensitive $ishAnnotations.IshRef } It "Find annotations and replies from Publication2 without RequestedMetadata" { $metadataFilter = Set-IshMetadataFilterField -IshSession $ishSession -Name FISHPUBLOGICALID -Level Annotation -FilterOperator Equal -Value $ishObjectPub2.IshRef $ishAnnotations = Find-IshAnnotation -IshSession $ishsession ` -MetadataFilter $metadataFilter - $ishAnnotations.Count | Should -BeExactly 2 - $replyIdsP2 -contains $ishAnnotations[0].ReplyRef | Should -Be $true - $replyIdsP2 -contains $ishAnnotations[1].ReplyRef | Should -Be $true + $ishAnnotations.Count | Should-Be 2 + $replyIdsP2 -contains $ishAnnotations[0].ReplyRef | Should-Be $true + $replyIdsP2 -contains $ishAnnotations[1].ReplyRef | Should-Be $true } } Context "Find-IshAnnotation using FilterOperator cilike since 15/15.0.0" { @@ -134,10 +134,10 @@ Describe "Find-IshAnnotation" -Tags "Create" { $ishAnnotations = Find-IshAnnotation -IshSession $ishsession ` -RequestedMetadata $requestedMetadata ` -MetadataFilter $metadataFilter - $ishAnnotations.Count | Should -BeExactly 4 + $ishAnnotations.Count | Should-Be 4 foreach($ishAnnotation in $ishAnnotations) { - $ishAnnotation.fishannotationtext_annotation_value.Contains("ISHRemote Pester on") | Should -Be $true + $ishAnnotation.fishannotationtext_annotation_value.Contains("ISHRemote Pester on") | Should-Be $true } } } @@ -149,8 +149,8 @@ Describe "Find-IshAnnotation" -Tags "Create" { $ishAnnotation = Find-IshAnnotation -IshSession $ishsession ` -RequestedMetadata $requestedMetadata ` -MetadataFilter $metadataFilter - $ishAnnotation.Count | Should -BeExactly 1 - $ishAnnotation.fishannotationtext_annotation_value | Should -Be "by #1 ISHRemote Pester on $timestamp" + $ishAnnotation.Count | Should-Be 1 + $ishAnnotation.fishannotationtext_annotation_value | Should-Be "by #1 ISHRemote Pester on $timestamp" } } It "FilterOperator cilike with matching casing of the original and filter values" { @@ -161,10 +161,10 @@ Describe "Find-IshAnnotation" -Tags "Create" { $ishAnnotations = Find-IshAnnotation -IshSession $ishsession ` -RequestedMetadata $requestedMetadata ` -MetadataFilter $metadataFilter - $ishAnnotations.Count | Should -BeExactly 2 + $ishAnnotations.Count | Should-Be 2 foreach($ishAnnotation in $ishAnnotations) { - $ishAnnotation.fishannotationtext_annotation_value.Contains("by ISHRemote Pester") | Should -Be $true + $ishAnnotation.fishannotationtext_annotation_value.Contains("by ISHRemote Pester") | Should-Be $true } } } @@ -174,9 +174,9 @@ Describe "Find-IshAnnotation" -Tags "Create" { $metadataFilter = Set-IshMetadataFilterField -IshSession $ishSession -Name FISHANNOTATIONTEXT -Level Annotation -FilterOperator CiLike -Value "" $exception = { Find-IshAnnotation -IshSession $ishsession ` -RequestedMetadata $requestedMetadata ` - -MetadataFilter $metadataFilter } | Should -Throw -PassThru - $exception -like "*102014*" | Should -Be $true - $exception -like "*InvalidNumberOfFilterValuesForOperator*" | Should -Be $true + -MetadataFilter $metadataFilter } | Should-Throw + $exception -like "*102014*" | Should-Be $true + $exception -like "*InvalidNumberOfFilterValuesForOperator*" | Should-Be $true } } It "FilterOperator cilike with filter on LovFieldValue status field" { @@ -185,9 +185,9 @@ Describe "Find-IshAnnotation" -Tags "Create" { $metadataFilter = Set-IshMetadataFilterField -IshSession $ishSession -Name FSTATUS -Level Annotation -FilterOperator CiLike -Value "DraFT%" $exception = { Find-IshAnnotation -IshSession $ishsession ` -RequestedMetadata $requestedMetadata ` - -MetadataFilter $metadataFilter } | Should -Throw -PassThru - $exception -like "*102013*" | Should -Be $true - $exception -like "*InvalidOperatorForFieldType*" | Should -Be $true + -MetadataFilter $metadataFilter } | Should-Throw + $exception -like "*102013*" | Should-Be $true + $exception -like "*InvalidOperatorForFieldType*" | Should-Be $true } } } @@ -198,10 +198,10 @@ Describe "Find-IshAnnotation" -Tags "Create" { $metadataFilter = Set-IshMetadataFilterField -IshSession $ishSession -Name FISHANNOTATIONTEXT -Level Annotation -FilterOperator CiLike -Value "%ishreMOTE pEsTEr ON%" $exception = { Find-IshAnnotation -IshSession $ishsession ` -RequestedMetadata $requestedMetadata ` - -MetadataFilter $metadataFilter } | Should -Throw -PassThru + -MetadataFilter $metadataFilter } | Should-Throw # 14.0.4 message is: [-105002] The XML of xmlMetadataFilter did not pass schema ISHAnnotationFilterFields validation. The 'ishoperator' attribute is invalid - The value 'cilike' is invalid according to its datatype 'IshOperator' - The Enumeration constraint failed. [105002;SchemaValidationFailure] - $exception -like "*105002*" | Should -Be $true - $exception -like "*SchemaValidationFailure*" | Should -Be $true + $exception -like "*105002*" | Should-Be $true + $exception -like "*SchemaValidationFailure*" | Should-Be $true } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/GetIshAnnotation.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/GetIshAnnotation.Tests.ps1 index d133aed..ff8293e 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/GetIshAnnotation.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/GetIshAnnotation.Tests.ps1 @@ -36,7 +36,7 @@ Describe "Get-IshAnnotation" -Tags "Create" { } } $bmp.Save($tempFilePath, [System.Drawing.Imaging.ImageFormat]::Jpeg) - $ishObjectImage = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderImage -IshType ISHIllustration -LogicalId "MYOWNGENERATEDLOGICALIDIMAGE" -Version '1' -Lng $ishLng -Resolution $ishResolution -Metadata $ishImageMetadata -Edt "EDTJPEG" -FilePath $tempFilePath + $ishObjectImage = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderImage -IshType ISHIllustration -LogicalId "GETISHANNOTATION-MYOWNGENERATEDLOGICALIDIMAGE" -Version '1' -Lng $ishLng -Resolution $ishResolution -Metadata $ishImageMetadata -Edt "EDTJPEG" -FilePath $tempFilePath ## Publication 1 #add topic @@ -136,20 +136,20 @@ Describe "Get-IshAnnotation" -Tags "Create" { } Context "Get-IshAnnotation ParameterGroup" { It "Parameter AnnotationId is an empty array" { - {Get-IshAnnotation -IshSession $ishsession -AnnotationId @()} | Should -Throw + {Get-IshAnnotation -IshSession $ishsession -AnnotationId @()} | Should-Throw } It "Parameter AnnotationId contains non-existing Ids" { $ishAnnotations = Get-IshAnnotation -IshSession $ishsession -AnnotationId @("GUID-NON-EXISTING1","GUID-NON-EXISTING1") - $ishAnnotations.Count | Should -Be 0 - $ishAnnotations | Should -Be $null + $ishAnnotations.Count | Should-Be 0 + $ishAnnotations | Should-Be $null } It "Get without RequestedMetadata and MetadataFilter" { $ishAnnotations = Get-IshAnnotation -IshSession $ishsession -AnnotationId @($ishAnnotation1P1.IshRef, $ishAnnotation2P1.IshRef) - $ishAnnotations.Count | Should -BeExactly 2 - $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should -Be $true - $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should -Be $true + $ishAnnotations.Count | Should-Be 2 + $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should-Be $true + $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should-Be $true } - It "Get with RequstedMetadata and without MetadataFilter" { + It "Get with RequestedMetadata and without MetadataFilter" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "FISHANNOTATIONREPLIES" -Level Annotation $ishAnnotations = Get-IshAnnotation -IshSession $ishsession ` -AnnotationId @($ishAnnotation1P1.IshRef, $ishAnnotation2P1.IshRef) ` @@ -157,107 +157,107 @@ Describe "Get-IshAnnotation" -Tags "Create" { $repliesValue1 = Get-IshMetadataField -IshObject $ishAnnotations[0] -Name "FISHANNOTATIONREPLIES" -Level Annotation -ValueType Value $repliesValue2 = Get-IshMetadataField -IshObject $ishAnnotations[1] -Name "FISHANNOTATIONREPLIES" -Level Annotation -ValueType Value - $ishAnnotations.Count | Should -BeExactly 2 - $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should -Be $true - $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should -Be $true - $repliesValue1 | Should -Be "" - $repliesValue2 | Should -Be "" + $ishAnnotations.Count | Should-Be 2 + $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should-Be $true + $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should-Be $true + $repliesValue1 | Should-Be "" + $repliesValue2 | Should-Be "" } - It "Get with RequstedMetadata and with MetadataFilter" { + It "Get with RequestedMetadata and with MetadataFilter" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "FISHANNOTATIONREPLIES" -Level Annotation $metadataFilter = Set-IshMetadataFilterField -IshSession $ishSession -Name FISHANNOTATIONTEXT -Level Annotation -FilterOperator Like -Value "by #1%" $ishAnnotations = Get-IshAnnotation -IshSession $ishsession ` -AnnotationId @($ishAnnotation1P1.IshRef, $ishAnnotation2P1.IshRef) ` -RequestedMetadata $requestedMetadata ` -MetadataFilter $metadataFilter - $ishAnnotations.Count | Should -BeExactly 1 + $ishAnnotations.Count | Should-Be 1 $metadataFilter = Set-IshMetadataFilterField -IshSession $ishSession -Name FISHANNOTATIONTEXT -Level Annotation -FilterOperator Like -Value "by%" $ishAnnotations = Get-IshAnnotation -IshSession $ishsession ` -AnnotationId @($ishAnnotation1P1.IshRef, $ishAnnotation2P1.IshRef) ` -RequestedMetadata $requestedMetadata ` -MetadataFilter $metadataFilter - $ishAnnotations.Count | Should -BeExactly 2 + $ishAnnotations.Count | Should-Be 2 } } Context "Get-IshAnnotation IshObjectGroup" { It "Get for Map object" { $ishAnnotations = $ishObjectMap1 | Get-IshAnnotation -IshSession $ishsession - $ishAnnotations.Count | Should -BeExactly 0 + $ishAnnotations.Count | Should-Be 0 } It "Get for Image object" { $ishAnnotations = $ishObjectImage | Get-IshAnnotation -IshSession $ishsession - $ishAnnotations.Count | Should -BeExactly 0 + $ishAnnotations.Count | Should-Be 0 } It "Get for Publication1 without RequestedMetadata" { $ishAnnotations = Get-IshAnnotation -IshSession $ishsession -IshObject $ishObjectPub1 - $ishAnnotations.Count | Should -BeExactly 2 - $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should -Be $true - $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should -Be $true + $ishAnnotations.Count | Should-Be 2 + $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should-Be $true + $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should-Be $true } It "Get for Publication1 with RequestedMetadata" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation $ishAnnotations = Get-IshAnnotation -IshSession $ishsession -IshObject $ishObjectPub1 -RequestedMetadata $requestedMetadata - $ishAnnotations.Count | Should -BeExactly 2 - $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should -Be $true - $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should -Be $true - $ishAnnotations[0].fishannotproposedchngtxt_annotation_value | Should -BeExactly $proposedChngText - $ishAnnotations[1].fishannotproposedchngtxt_annotation_value | Should -BeExactly $proposedChngText - Get-IshMetadataField -IshObject $ishAnnotations[0] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should -BeExactly $proposedChngText - Get-IshMetadataField -IshObject $ishAnnotations[1] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should -BeExactly $proposedChngText + $ishAnnotations.Count | Should-Be 2 + $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should-Be $true + $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should-Be $true + $ishAnnotations[0].fishannotproposedchngtxt_annotation_value | Should-BeString -CaseSensitive $proposedChngText + $ishAnnotations[1].fishannotproposedchngtxt_annotation_value | Should-BeString -CaseSensitive $proposedChngText + Get-IshMetadataField -IshObject $ishAnnotations[0] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should-BeString -CaseSensitive $proposedChngText + Get-IshMetadataField -IshObject $ishAnnotations[1] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should-BeString -CaseSensitive $proposedChngText } It "Get for Publication1 with RequestedMetadata, Pipeline" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation $ishAnnotations = $ishObjectPub1 | Get-IshAnnotation -IshSession $ishsession -RequestedMetadata $requestedMetadata - $ishAnnotations.Count | Should -BeExactly 2 - Get-IshMetadataField -IshObject $ishAnnotations[0] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should -BeExactly $proposedChngText - Get-IshMetadataField -IshObject $ishAnnotations[1] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should -BeExactly $proposedChngText + $ishAnnotations.Count | Should-Be 2 + Get-IshMetadataField -IshObject $ishAnnotations[0] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should-BeString -CaseSensitive $proposedChngText + Get-IshMetadataField -IshObject $ishAnnotations[1] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should-BeString -CaseSensitive $proposedChngText } It "Get for Publication1,Publication2 with RequestedMetadata, Pipeline" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation $ishAnnotations = @($ishObjectPub1, $ishObjectPub2) | Get-IshAnnotation -IshSession $ishsession -RequestedMetadata $requestedMetadata - $ishAnnotations.Count | Should -BeExactly 4 - $annotationIdsP1P2 -contains $ishAnnotations[0].IshRef | Should -Be $true - $annotationIdsP1P2 -contains $ishAnnotations[1].IshRef | Should -Be $true - $annotationIdsP1P2 -contains $ishAnnotations[2].IshRef | Should -Be $true - $annotationIdsP1P2 -contains $ishAnnotations[3].IshRef | Should -Be $true + $ishAnnotations.Count | Should-Be 4 + $annotationIdsP1P2 -contains $ishAnnotations[0].IshRef | Should-Be $true + $annotationIdsP1P2 -contains $ishAnnotations[1].IshRef | Should-Be $true + $annotationIdsP1P2 -contains $ishAnnotations[2].IshRef | Should-Be $true + $annotationIdsP1P2 -contains $ishAnnotations[3].IshRef | Should-Be $true } It "Get for Topic without RequestedMetadata" { $ishAnnotations = Get-IshAnnotation -IshSession $ishsession -IshObject $ishObjectTopic1 - $ishAnnotations.Count | Should -BeExactly 2 - $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should -Be $true - $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should -Be $true + $ishAnnotations.Count | Should-Be 2 + $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should-Be $true + $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should-Be $true } It "Get for Topic with RequestedMetadata" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation $ishAnnotations = Get-IshAnnotation -IshSession $ishsession -IshObject $ishObjectTopic1 -RequestedMetadata $requestedMetadata - $ishAnnotations.Count | Should -BeExactly 2 - Get-IshMetadataField -IshObject $ishAnnotations[0] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should -BeExactly $proposedChngText - Get-IshMetadataField -IshObject $ishAnnotations[1] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should -BeExactly $proposedChngText + $ishAnnotations.Count | Should-Be 2 + Get-IshMetadataField -IshObject $ishAnnotations[0] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should-BeString -CaseSensitive $proposedChngText + Get-IshMetadataField -IshObject $ishAnnotations[1] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should-BeString -CaseSensitive $proposedChngText } It "Get for Topic with RequestedMetadata, Pipeline" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation $ishAnnotations = $ishObjectTopic1 | Get-IshAnnotation -IshSession $ishsession -RequestedMetadata $requestedMetadata - $ishAnnotations.Count | Should -BeExactly 2 - Get-IshMetadataField -IshObject $ishAnnotations[0] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should -BeExactly $proposedChngText - Get-IshMetadataField -IshObject $ishAnnotations[1] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should -BeExactly $proposedChngText + $ishAnnotations.Count | Should-Be 2 + Get-IshMetadataField -IshObject $ishAnnotations[0] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should-BeString -CaseSensitive $proposedChngText + Get-IshMetadataField -IshObject $ishAnnotations[1] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should-BeString -CaseSensitive $proposedChngText } It "Get for Topic1, Topic2 with RequestedMetadata, Pipeline" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation $ishAnnotations = @($ishObjectTopic1, $ishObjectTopic2) | Get-IshAnnotation -IshSession $ishsession -RequestedMetadata $requestedMetadata - $ishAnnotations.Count | Should -BeExactly 4 - $annotationIdsP1P2 -contains $ishAnnotations[0].IshRef | Should -Be $true - $annotationIdsP1P2 -contains $ishAnnotations[1].IshRef | Should -Be $true - $annotationIdsP1P2 -contains $ishAnnotations[2].IshRef | Should -Be $true - $annotationIdsP1P2 -contains $ishAnnotations[3].IshRef | Should -Be $true + $ishAnnotations.Count | Should-Be 4 + $annotationIdsP1P2 -contains $ishAnnotations[0].IshRef | Should-Be $true + $annotationIdsP1P2 -contains $ishAnnotations[1].IshRef | Should-Be $true + $annotationIdsP1P2 -contains $ishAnnotations[2].IshRef | Should-Be $true + $annotationIdsP1P2 -contains $ishAnnotations[3].IshRef | Should-Be $true } It "Get for Publication3 where annotation has 2 replies"{ $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation $ishAnnotations = $ishObjectPub3 | Get-IshAnnotation -IshSession $ishsession -RequestedMetadata $requestedMetadata - $ishAnnotations.Count | Should -BeExactly 2 - $replyIdsP3 -contains $ishAnnotations[0].ReplyRef | Should -Be $true - $replyIdsP3 -contains $ishAnnotations[1].ReplyRef | Should -Be $true + $ishAnnotations.Count | Should-Be 2 + $replyIdsP3 -contains $ishAnnotations[0].ReplyRef | Should-Be $true + $replyIdsP3 -contains $ishAnnotations[1].ReplyRef | Should-Be $true } } Context "Get-IshAnnotation IshObjectGroup mixed IshObjects from Get-IshFolderContent" { @@ -265,10 +265,10 @@ Describe "Get-IshAnnotation" -Tags "Create" { $ishAnnotations = Get-IshFolder -IshSession $ishsession -FolderId ($global:ishAnnotationCmdlet.IshFolderRef) -Recurse | Get-IshFolderContent -IshSession $ishsession | Get-IshAnnotation -IshSession $ishsession - $ishAnnotations.Count | Should -BeExactly 6 + $ishAnnotations.Count | Should-Be 6 foreach($ishAnnotation in $ishAnnotations) { - $annotationIdsP1P2P3 -contains $ishAnnotation.IshRef | Should -Be $true + $annotationIdsP1P2P3 -contains $ishAnnotation.IshRef | Should-Be $true } } @@ -276,57 +276,57 @@ Describe "Get-IshAnnotation" -Tags "Create" { $ishObjects = Get-Ishfolder -IshSession $ishsession -FolderId ($global:ishAnnotationCmdlet.IshFolderRef) -Recurse | Get-IshFolderContent -IshSession $ishsession $ishAnnotations = Get-IshAnnotation -IshSession $ishsession -IshObject $ishObjects - $ishAnnotations.Count | Should -BeExactly 6 + $ishAnnotations.Count | Should-Be 6 foreach($ishAnnotation in $ishAnnotations) { - $annotationIdsP1P2P3 -contains $ishAnnotation.IshRef | Should -Be $true + $annotationIdsP1P2P3 -contains $ishAnnotation.IshRef | Should-Be $true } } } Context "Get-IshAnnotation IshAnnotationGroup" { It "Get array of IshAnnotation without RequestedMetadata" { $ishAnnotations = Get-IshAnnotation -IshSession $ishsession -IshAnnotation @($ishAnnotation1P1, $ishAnnotation2P1) - $ishAnnotations.Count | Should -BeExactly 2 - $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should -Be $true - $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should -Be $true + $ishAnnotations.Count | Should-Be 2 + $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should-Be $true + $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should-Be $true } It "Get array of IshAnnotation with RequestedMetadata" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation $ishAnnotations = Get-IshAnnotation -IshSession $ishsession -IshAnnotation @($ishAnnotation1P1, $ishAnnotation2P1) -RequestedMetadata $requestedMetadata - $ishAnnotations.Count | Should -BeExactly 2 - $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should -Be $true - $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should -Be $true - Get-IshMetadataField -IshObject $ishAnnotations[0] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should -BeExactly $proposedChngText - Get-IshMetadataField -IshObject $ishAnnotations[1] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should -BeExactly $proposedChngText + $ishAnnotations.Count | Should-Be 2 + $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should-Be $true + $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should-Be $true + Get-IshMetadataField -IshObject $ishAnnotations[0] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should-BeString -CaseSensitive $proposedChngText + Get-IshMetadataField -IshObject $ishAnnotations[1] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should-BeString -CaseSensitive $proposedChngText } It "Get single IshAnnotation without RequestedMetadata" { $ishAnnotations = Get-IshAnnotation -IshSession $ishsession -IshAnnotation $ishAnnotation1P1 - $ishAnnotations.Count | Should -BeExactly 1 - $ishAnnotations.IshRef | Should -BeExactly $ishAnnotation1P1.IshRef + $ishAnnotations.Count | Should-Be 1 + $ishAnnotations.IshRef | Should-BeString -CaseSensitive $ishAnnotation1P1.IshRef } It "Get single IshAnnotation with RequestedMetadata" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation $ishAnnotations = Get-IshAnnotation -IshSession $ishsession -IshAnnotation $ishAnnotation1P1 -RequestedMetadata $requestedMetadata - $ishAnnotations.Count | Should -BeExactly 1 - $ishAnnotations.IshRef | Should -BeExactly $ishAnnotation1P1.IshRef - Get-IshMetadataField -IshObject $ishAnnotations -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should -BeExactly $proposedChngText + $ishAnnotations.Count | Should-Be 1 + $ishAnnotations.IshRef | Should-BeString -CaseSensitive $ishAnnotation1P1.IshRef + Get-IshMetadataField -IshObject $ishAnnotations -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should-BeString -CaseSensitive $proposedChngText } It "Get with RequestedMetadata, pipeline single object" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation $ishAnnotations = $ishAnnotation1P1 | Get-IshAnnotation -IshSession $ishsession -RequestedMetadata $requestedMetadata - $ishAnnotations.Count | Should -BeExactly 1 - $annotationIdsP1 -contains $ishAnnotations.IshRef | Should -Be $true - Get-IshMetadataField -IshObject $ishAnnotations -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should -BeExactly $proposedChngText + $ishAnnotations.Count | Should-Be 1 + $annotationIdsP1 -contains $ishAnnotations.IshRef | Should-Be $true + Get-IshMetadataField -IshObject $ishAnnotations -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should-BeString -CaseSensitive $proposedChngText } It "Get with RequestedMetadata, pipeline array" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation $ishAnnotations = @($ishAnnotation1P1, $ishAnnotation2P1) | Get-IshAnnotation -IshSession $ishsession -RequestedMetadata $requestedMetadata - $ishAnnotations.Count | Should -BeExactly 2 - $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should -Be $true - $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should -Be $true - Get-IshMetadataField -IshObject $ishAnnotations[0] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should -BeExactly $proposedChngText - Get-IshMetadataField -IshObject $ishAnnotations[1] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should -BeExactly $proposedChngText + $ishAnnotations.Count | Should-Be 2 + $annotationIdsP1 -contains $ishAnnotations[0].IshRef | Should-Be $true + $annotationIdsP1 -contains $ishAnnotations[1].IshRef | Should-Be $true + Get-IshMetadataField -IshObject $ishAnnotations[0] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should-BeString -CaseSensitive $proposedChngText + Get-IshMetadataField -IshObject $ishAnnotations[1] -Name "FISHANNOTPROPOSEDCHNGTXT" -Level Annotation | Should-BeString -CaseSensitive $proposedChngText } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/RemoveIshAnnotation.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/RemoveIshAnnotation.Tests.ps1 index 5d06ca6..99c020d 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/RemoveIshAnnotation.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/RemoveIshAnnotation.Tests.ps1 @@ -92,71 +92,71 @@ Describe "Remove-IshAnnotation" -Tags "Create" { Context "Remove-IshAnnotation ParameterGroup" { It "Parameter AnnotationId is empty" { - {Remove-IshAnnotation -IshSession $ishsession -AnnotationId ""} | Should -Throw + {Remove-IshAnnotation -IshSession $ishsession -AnnotationId ""} | Should-Throw } It "Parameter AnnotationId non-existing Id" { - {Remove-IshAnnotation -IshSession $ishsession -AnnotationId "GUID-NON-EXISTING"} | Should -Throw + {Remove-IshAnnotation -IshSession $ishsession -AnnotationId "GUID-NON-EXISTING"} | Should-Throw } It "Annotation with replies" { $ishAnnotation = Remove-IshAnnotation -IshSession $ishsession -AnnotationId $ishAnnotationPGWithReplies.IshRef - $ishAnnotation -eq $null | Should -Be $true + $ishAnnotation -eq $null | Should-Be $true $ishAnnotation = Get-IshAnnotation -IshSession $ishsession -AnnotationId $ishAnnotationPGWithReplies.IshRef - $ishAnnotation.Count | Should -Be 0 + $ishAnnotation.Count | Should-Be 0 } It "Annotation without replies" { $ishAnnotation = Remove-IshAnnotation -IshSession $ishsession -AnnotationId $ishAnnotationPG1.IshRef - $ishAnnotation -eq $null | Should -Be $true + $ishAnnotation -eq $null | Should-Be $true $ishAnnotation = Get-IshAnnotation -IshSession $ishsession -AnnotationId $ishAnnotationPG1.IshRef - $ishAnnotation.Count | Should -Be 0 + $ishAnnotation.Count | Should-Be 0 } } Context "Remove-IshAnnotation IshAnnotationGroup" { It "Annotation with replies" { $ishAnnotation = Remove-IshAnnotation -IshSession $ishsession -IshAnnotation $ishAnnotationIAGWithReplies - $ishAnnotation -eq $null | Should -Be $true + $ishAnnotation -eq $null | Should-Be $true $ishAnnotation = Get-IshAnnotation -IshSession $ishsession -AnnotationId $ishAnnotationIAGWithReplies.IshRef - $ishAnnotation.Count | Should -Be 0 + $ishAnnotation.Count | Should-Be 0 } It "Annotation without replies" { $ishAnnotation = Remove-IshAnnotation -IshSession $ishsession -IshAnnotation $ishAnnotationIAG1 - $ishAnnotation -eq $null | Should -Be $true + $ishAnnotation -eq $null | Should-Be $true $ishAnnotation = Get-IshAnnotation -IshSession $ishsession -AnnotationId $ishAnnotationIAG1.IshRef - $ishAnnotation.Count | Should -Be 0 + $ishAnnotation.Count | Should-Be 0 } It "Annotations mixed(with and without replies), passing as array" { $ishAnnotation = Remove-IshAnnotation -IshSession $ishsession -IshAnnotation @($ishAnnotationIAGMixed1, $ishAnnotationIAGMixedWithReplies, $ishAnnotationIAGMixed2) - $ishAnnotation -eq $null | Should -Be $true + $ishAnnotation -eq $null | Should-Be $true $ishAnnotation = Get-IshAnnotation -IshSession $ishsession -AnnotationId @($ishAnnotationIAGMixed1.IshRef, $ishAnnotationIAGMixedWithReplies.IshRef, $ishAnnotationIAGMixed2.IshRef) - $ishAnnotation.Count | Should -Be 0 + $ishAnnotation.Count | Should-Be 0 } } Context "Remove-IshAnnotation IshAnnotationGroup pipeline" { It "Passing empty collection via pipeline"{ $ishObjects = Get-Ishfolder -IshSession $ishsession -FolderId ($global:ishAnnotationCmdlet.IshFolderRef) | Get-IshFolderContent -IshSession $ishsession - $ishObjects.Count | Should -Be 0 + $ishObjects.Count | Should-Be 0 {Get-Ishfolder -IshSession $ishsession -FolderId ($global:ishAnnotationCmdlet.IshFolderRef) | Get-IshFolderContent -IshSession $ishsession | Remove-IshAnnotation -IshSession $ishsession} | Should -Not -Throw } It "Annotations with replies, passing one by one" { $ishAnnotation = @($ishAnnotationIAGpipeline1WithReplies, $ishAnnotationIAGpipeline2WithReplies) | Remove-IshAnnotation -IshSession $ishsession - $ishAnnotation -eq $null | Should -Be $true + $ishAnnotation -eq $null | Should-Be $true $ishAnnotation = Get-IshAnnotation -IshSession $ishsession -AnnotationId @($ishAnnotationIAGpipeline1WithReplies.IshRef, $ishAnnotationIAGpipeline2WithReplies.IshRef) - $ishAnnotation.Count | Should -Be 0 + $ishAnnotation.Count | Should-Be 0 } It "Annotations without replies, passing one by one" { $ishAnnotation = @($ishAnnotationIAGpipeline2, $ishAnnotationIAGpipeline1) | Remove-IshAnnotation -IshSession $ishsession - $ishAnnotation -eq $null | Should -Be $true + $ishAnnotation -eq $null | Should-Be $true $ishAnnotation = Get-IshAnnotation -IshSession $ishsession -AnnotationId @($ishAnnotationIAGpipeline2.IshRef, $ishAnnotationIAGpipeline1.IshRef) - $ishAnnotation.Count | Should -Be 0 + $ishAnnotation.Count | Should-Be 0 } It "Annotations mixed(with and without replies), passing whole array" { $ishAnnotation = @($ishAnnotationPipelineMixed, $ishAnnotationPipelineMixedWithReplies) | Remove-IshAnnotation -IshSession $ishsession - $ishAnnotation -eq $null | Should -Be $true + $ishAnnotation -eq $null | Should-Be $true $ishAnnotation = Get-IshAnnotation -IshSession $ishsession -AnnotationId @($ishAnnotationPipelineMixed.IshRef, $ishAnnotationPipelineMixedWithReplies.IshRef) - $ishAnnotation.Count | Should -Be 0 + $ishAnnotation.Count | Should-Be 0 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/SetIshAnnotation.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/SetIshAnnotation.Tests.ps1 index f6c69c4..295fcfe 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/SetIshAnnotation.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Annotation/SetIshAnnotation.Tests.ps1 @@ -65,17 +65,17 @@ Describe "Set-IshAnnotation" -Tags "Create" { } Context "Set-IshAnnotation ParameterGroup" { It "Parameter AnnotationId is empty" { - {Set-IshAnnotation -IshSession $ishsession -AnnotationId "" -Metadata (Set-IshMetadataField -Name "FISHANNOTATIONTEXT" -Level Annotation -Value "update should fail")} | Should -Throw + {Set-IshAnnotation -IshSession $ishsession -AnnotationId "" -Metadata (Set-IshMetadataField -Name "FISHANNOTATIONTEXT" -Level Annotation -Value "update should fail")} | Should-Throw } It "Parameter AnnotationId non-existing Id" { - {Set-IshAnnotation -IshSession $ishsession -AnnotationId "GUID-NON-EXISTING" -Metadata (Set-IshMetadataField -Name "FISHANNOTATIONTEXT" -Level Annotation -Value "update should fail")} | Should -Throw + {Set-IshAnnotation -IshSession $ishsession -AnnotationId "GUID-NON-EXISTING" -Metadata (Set-IshMetadataField -Name "FISHANNOTATIONTEXT" -Level Annotation -Value "update should fail")} | Should-Throw } It "Set without RequiredCurrentMetadata" { $annotationTextUpdated = $ishAnnotationPG1.fishannotationtext_annotation_value + "updated" $metadataUpdate = Set-IshMetadataField -Name "FISHANNOTATIONTEXT" -Level Annotation -Value $annotationTextUpdated $ishAnnotation = Set-IshAnnotation -IshSession $ishsession -AnnotationId $ishAnnotationPG1.IshRef -Metadata $metadataUpdate - $ishAnnotation.IshRef | Should -BeExactly $ishAnnotationPG1.IshRef - $ishAnnotation.fishannotationtext_annotation_value | Should -BeExactly $annotationTextUpdated + $ishAnnotation.IshRef | Should-BeString -CaseSensitive $ishAnnotationPG1.IshRef + $ishAnnotation.fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationTextUpdated } It "Set with Metadata and RequiredCurrentMetadata (exception)" { $metadataUpdate = Set-IshMetadataField -Name "FISHANNOTATIONTEXT" -Level Annotation -Value "Update should fail" @@ -83,7 +83,7 @@ Describe "Set-IshAnnotation" -Tags "Create" { {Set-IshAnnotation -IshSession $ishsession ` -AnnotationId $ishAnnotationPG1.IshRef ` -Metadata $metadataUpdate ` - -RequiredCurrentMetadata $requiredCurrentMetadata} | Should -Throw + -RequiredCurrentMetadata $requiredCurrentMetadata} | Should-Throw } It "Set with Metadata and RequiredCurrentMetadata" { $requiredCurrentMetadata = Set-IshRequiredCurrentMetadataField -Name "FISHANNOTATIONSTATUS" -Value $annotationStatus -ValueType Value -Level Annotation @@ -93,8 +93,8 @@ Describe "Set-IshAnnotation" -Tags "Create" { -AnnotationId $ishAnnotationPG1.IshRef ` -Metadata $metadataUpdate ` -RequiredCurrentMetadata $requiredCurrentMetadata - $ishAnnotation.IshRef | Should -BeExactly $ishAnnotationPG1.IshRef - $ishAnnotation.fishannotationtext_annotation_value | Should -BeExactly $annotationTextUpdated + $ishAnnotation.IshRef | Should-BeString -CaseSensitive $ishAnnotationPG1.IshRef + $ishAnnotation.fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationTextUpdated } It "Annotation with replies, Set without RequiredCurrentMetadata" { @@ -102,8 +102,8 @@ Describe "Set-IshAnnotation" -Tags "Create" { $metadataUpdate = Set-IshMetadataField -Name "FISHANNOTATIONTEXT" -Level Annotation -Value $annotationTextUpdated $ishAnnotation = Set-IshAnnotation -IshSession $ishsession -AnnotationId $ishAnnotationPGWithReplies.IshRef -Metadata $metadataUpdate # TODO [Could] Pester 5 conversion showed that $ishAnnotation contains 2 identical objects, fixed by selecting array[0] - $ishAnnotation[0].IshRef | Should -BeExactly $ishAnnotationPGWithReplies.IshRef - $ishAnnotation[0].fishannotationtext_annotation_value | Should -BeExactly $annotationTextUpdated + $ishAnnotation[0].IshRef | Should-BeString -CaseSensitive $ishAnnotationPGWithReplies.IshRef + $ishAnnotation[0].fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationTextUpdated } It "Annotation with replies, Set with RequiredCurrentMetadata (exception)" { $metadataUpdate = Set-IshMetadataField -Name "FISHANNOTATIONTEXT" -Level Annotation -Value "Update should fail" @@ -111,7 +111,7 @@ Describe "Set-IshAnnotation" -Tags "Create" { {Set-IshAnnotation -IshSession $ishsession ` -AnnotationId $ishAnnotationPGWithReplies.IshRef ` -Metadata $metadataUpdate ` - -RequiredCurrentMetadata $requiredCurrentMetadata} | Should -Throw + -RequiredCurrentMetadata $requiredCurrentMetadata} | Should-Throw } It "Annotation with replies, Set with RequiredCurrentMetadata" { $requiredCurrentMetadata = Set-IshRequiredCurrentMetadataField -Name "FISHANNOTATIONSTATUS" -Value $annotationStatus -ValueType Value -Level Annotation @@ -122,8 +122,8 @@ Describe "Set-IshAnnotation" -Tags "Create" { -Metadata $metadataUpdate ` -RequiredCurrentMetadata $requiredCurrentMetadata # TODO [Could] Pester 5 conversion showed that $ishAnnotation contains 2 identical objects, fixed by selecting array[0] - $ishAnnotation[0].IshRef | Should -BeExactly $ishAnnotationPGWithReplies.IshRef - $ishAnnotation[0].fishannotationtext_annotation_value | Should -BeExactly $annotationTextUpdated + $ishAnnotation[0].IshRef | Should-BeString -CaseSensitive $ishAnnotationPGWithReplies.IshRef + $ishAnnotation[0].fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationTextUpdated } } @@ -132,8 +132,8 @@ Describe "Set-IshAnnotation" -Tags "Create" { $annotationTextUpdated = $ishAnnotationIAG1.fishannotationtext_annotation_value + "updated" $metadataUpdate = Set-IshMetadataField -Name "FISHANNOTATIONTEXT" -Level Annotation -Value $annotationTextUpdated $ishAnnotation = Set-IshAnnotation -IshSession $ishsession -IshAnnotation $ishAnnotationIAG1 -Metadata $metadataUpdate - $ishAnnotation.IshRef | Should -BeExactly $ishAnnotationIAG1.IshRef - $ishAnnotation.fishannotationtext_annotation_value | Should -BeExactly $annotationTextUpdated + $ishAnnotation.IshRef | Should-BeString -CaseSensitive $ishAnnotationIAG1.IshRef + $ishAnnotation.fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationTextUpdated } It "Set with RequiredCurrentMetadata (exception)" { $metadataUpdate = Set-IshMetadataField -Name "FISHANNOTATIONTEXT" -Level Annotation -Value "Update should fail" @@ -141,7 +141,7 @@ Describe "Set-IshAnnotation" -Tags "Create" { {Set-IshAnnotation -IshSession $ishsession ` -IshAnnotation $ishAnnotationIAG1 ` -Metadata $metadataUpdate ` - -RequiredCurrentMetadata $requiredCurrentMetadata} | Should -Throw + -RequiredCurrentMetadata $requiredCurrentMetadata} | Should-Throw } It "Set with RequiredCurrentMetadata" { $requiredCurrentMetadata = Set-IshRequiredCurrentMetadataField -Name "FISHANNOTATIONSTATUS" -Value $annotationStatus -ValueType Value -Level Annotation @@ -151,8 +151,8 @@ Describe "Set-IshAnnotation" -Tags "Create" { -IshAnnotation $ishAnnotationIAG1 ` -Metadata $metadataUpdate ` -RequiredCurrentMetadata $requiredCurrentMetadata - $ishAnnotation.IshRef | Should -BeExactly $ishAnnotationIAG1.IshRef - $ishAnnotation.fishannotationtext_annotation_value | Should -BeExactly $annotationTextUpdated + $ishAnnotation.IshRef | Should-BeString -CaseSensitive $ishAnnotationIAG1.IshRef + $ishAnnotation.fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationTextUpdated } It "Annotation with replies, Set without RequiredCurrentMetadata" { @@ -160,8 +160,8 @@ Describe "Set-IshAnnotation" -Tags "Create" { $metadataUpdate = Set-IshMetadataField -Name "FISHANNOTATIONTEXT" -Level Annotation -Value $annotationTextUpdated $ishAnnotation = Set-IshAnnotation -IshSession $ishsession -IshAnnotation $ishAnnotationIAGWithReplies -Metadata $metadataUpdate # TODO [Could] Pester 5 conversion showed that $ishAnnotation contains 2 identical objects, fixed by selecting array[0] - $ishAnnotation[0].IshRef | Should -BeExactly $ishAnnotationIAGWithReplies.IshRef - $ishAnnotation[0].fishannotationtext_annotation_value | Should -BeExactly $annotationTextUpdated + $ishAnnotation[0].IshRef | Should-BeString -CaseSensitive $ishAnnotationIAGWithReplies.IshRef + $ishAnnotation[0].fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationTextUpdated } It "Annotation with replies, Set with RequiredCurrentMetadata (exception)" { $metadataUpdate = Set-IshMetadataField -Name "FISHANNOTATIONTEXT" -Level Annotation -Value "Update should fail" @@ -169,7 +169,7 @@ Describe "Set-IshAnnotation" -Tags "Create" { {Set-IshAnnotation -IshSession $ishsession ` -IshAnnotation $ishAnnotationIAGWithReplies ` -Metadata $metadataUpdate ` - -RequiredCurrentMetadata $requiredCurrentMetadata} | Should -Throw + -RequiredCurrentMetadata $requiredCurrentMetadata} | Should-Throw } It "Annotation with replies, Set with RequiredCurrentMetadata" { $requiredCurrentMetadata = Set-IshRequiredCurrentMetadataField -Name "FISHANNOTATIONSTATUS" -Value $annotationStatus -ValueType Value -Level Annotation @@ -180,8 +180,8 @@ Describe "Set-IshAnnotation" -Tags "Create" { -Metadata $metadataUpdate ` -RequiredCurrentMetadata $requiredCurrentMetadata # TODO [Could] Pester 5 conversion showed that $ishAnnotation contains 2 identical objects, fixed by selecting array[0] - $ishAnnotation[0].IshRef | Should -BeExactly $ishAnnotationIAGWithReplies.IshRef - $ishAnnotation[0].fishannotationtext_annotation_value | Should -BeExactly $annotationTextUpdated + $ishAnnotation[0].IshRef | Should-BeString -CaseSensitive $ishAnnotationIAGWithReplies.IshRef + $ishAnnotation[0].fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationTextUpdated } } @@ -190,13 +190,13 @@ Describe "Set-IshAnnotation" -Tags "Create" { $ishAnnotationsPub = $ishObjectPub | Get-IshAnnotation -IshSession $ishSession foreach($ishAnnotation in $ishAnnotationsPub) { - $ishAnnotation.fishannotationstatus_annotation_value | Should -BeExactly $annotationStatus + $ishAnnotation.fishannotationstatus_annotation_value | Should-BeString -CaseSensitive $annotationStatus } $ishAnnotationsSet = $ishAnnotationsPub | Set-IshAnnotation -IshSession $ishsession ` -Metadata (Set-IshMetadataField -Name "FISHANNOTATIONSTATUS" -Level Annotation -Value $annotationStatusShared) foreach($ishAnnotation in $ishAnnotationsSet) { - $ishAnnotation.fishannotationstatus_annotation_value | Should -BeExactly $annotationStatusShared + $ishAnnotation.fishannotationstatus_annotation_value | Should-BeString -CaseSensitive $annotationStatusShared } } @@ -209,7 +209,7 @@ Describe "Set-IshAnnotation" -Tags "Create" { -RequiredCurrentMetadata $requiredCurrentMetadata foreach($ishAnnotation in $ishAnnotationsSet) { - $ishAnnotation.fishannotationtext_annotation_value | Should -BeExactly $annotationTextUpdated + $ishAnnotation.fishannotationtext_annotation_value | Should-BeString -CaseSensitive $annotationTextUpdated } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Application/GetIshVersion.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Application/GetIshVersion.Tests.ps1 index b85c341..bf999d4 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Application/GetIshVersion.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Application/GetIshVersion.Tests.ps1 @@ -9,7 +9,7 @@ BeforeAll { Describe "Get-IshVersion" -Tags "Read" { Context "Get-IshVersion Parameters" { It "Parameter IshSession invalid" { - { Get-IshVersion -IshSession "INVALIDISHSESSION" } | Should -Throw + { Get-IshVersion -IshSession "INVALIDISHSESSION" } | Should-Throw } } @@ -18,19 +18,19 @@ Describe "Get-IshVersion" -Tags "Read" { $ishVersion = Get-IshVersion -IshSession $ishSession } It "GetType()" { - $ishVersion.GetType().Name | Should -BeExactly "IshVersion" + $ishVersion.GetType().Name | Should-BeString -CaseSensitive "IshVersion" } It "IshVersion.MajorVersion" { - $ishVersion.MajorVersion -ge 0 | Should -Be $true + $ishVersion.MajorVersion -ge 0 | Should-Be $true } It "IshVersion.MinorVersion" { - $ishVersion.MinorVersion -ge 0 | Should -Be $true + $ishVersion.MinorVersion -ge 0 | Should-Be $true } It "IshVersion.BuildVersion" { - $ishVersion.BuildVersion -ge 0 | Should -Be $true + $ishVersion.BuildVersion -ge 0 | Should-Be $true } It "IshSession.RevisionVersion" { - $ishVersion.RevisionVersion -ge 0 | Should -Be $true + $ishVersion.RevisionVersion -ge 0 | Should-Be $true } } @@ -39,19 +39,19 @@ Describe "Get-IshVersion" -Tags "Read" { $ishVersion = Get-IshVersion } It "GetType()" { - $ishVersion.GetType().Name | Should -BeExactly "IshVersion" + $ishVersion.GetType().Name | Should-BeString -CaseSensitive "IshVersion" } It "IshVersion.MajorVersion" { - $ishVersion.MajorVersion -ge 0 | Should -Be $true + $ishVersion.MajorVersion -ge 0 | Should-Be $true } It "IshVersion.MinorVersion" { - $ishVersion.MinorVersion -ge 0 | Should -Be $true + $ishVersion.MinorVersion -ge 0 | Should-Be $true } It "IshVersion.BuildVersion" { - $ishVersion.BuildVersion -ge 0 | Should -Be $true + $ishVersion.BuildVersion -ge 0 | Should-Be $true } It "IshSession.RevisionVersion" { - $ishVersion.RevisionVersion -ge 0 | Should -Be $true + $ishVersion.RevisionVersion -ge 0 | Should-Be $true } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/BackgroundTask/AddIshBackgroundTask.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/BackgroundTask/AddIshBackgroundTask.Tests.ps1 index 70d2dda..4b235a2 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/BackgroundTask/AddIshBackgroundTask.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/BackgroundTask/AddIshBackgroundTask.Tests.ps1 @@ -41,31 +41,31 @@ Describe "Add-IshBackgroundTask" -Tags "Create" { Context "Add-IshBackgroundTask IshObjectGroup Parameter IshObject with implicit IshSession since 14SP4/14.0.4" { It "Parameter IshObject invalid" { if (([Version]$ishSession.ServerVersion).Major -ge 15 -or (([Version]$ishSession.ServerVersion).Major -ge 14 -and ([Version]$ishSession.ServerVersion).Revision -ge 4)) { - { Add-IshBackgroundTask -EventType $ishEventTypeToPurge -IshObject "INVALIDISHOBJECT" } | Should -Throw + { Add-IshBackgroundTask -EventType $ishEventTypeToPurge -IshObject "INVALIDISHOBJECT" } | Should-Throw } } It "Parameter EventType null" { if (([Version]$ishSession.ServerVersion).Major -ge 15 -or (([Version]$ishSession.ServerVersion).Major -ge 14 -and ([Version]$ishSession.ServerVersion).Revision -ge 4)) { - { Add-IshBackgroundTask -EventType $null -IshObject $ishObjects } | Should -Throw + { Add-IshBackgroundTask -EventType $null -IshObject $ishObjects } | Should-Throw } } It "Pipeline IshObject Single" { if (([Version]$ishSession.ServerVersion).Major -ge 15 -or (([Version]$ishSession.ServerVersion).Major -ge 14 -and ([Version]$ishSession.ServerVersion).Revision -ge 4)) { $ishBackgroundTaskIshObjectsParameter = Add-IshBackgroundTask -EventType $ishEventTypeToPurge -IshObject $ishObjectTopic1_1 - $ishObjectTopic1_1.Count | Should -BeExactly 1 - $ishBackgroundTaskIshObjectsParameter.Count | Should -BeExactly 1 - $ishBackgroundTaskIshObjectsParameter.GetType() | Should -BeExactly Trisoft.ISHRemote.Objects.Public.IshBackgroundTask - $ishBackgroundTaskIshObjectsParameter.EventType | Should -BeExactly $ishEventTypeToPurge - $ishBackgroundTaskIshObjectsParameter.userid | Should -BeExactly $ishSession.UserName + $ishObjectTopic1_1.Count | Should-Be 1 + $ishBackgroundTaskIshObjectsParameter.Count | Should-Be 1 + $ishBackgroundTaskIshObjectsParameter | Should-HaveType Trisoft.ISHRemote.Objects.Public.IshBackgroundTask + $ishBackgroundTaskIshObjectsParameter.EventType | Should-BeString -CaseSensitive $ishEventTypeToPurge + $ishBackgroundTaskIshObjectsParameter.userid | Should-BeString -CaseSensitive $ishSession.UserName } } It "Pipeline IshObject Multiple" { if (([Version]$ishSession.ServerVersion).Major -ge 15 -or (([Version]$ishSession.ServerVersion).Major -ge 14 -and ([Version]$ishSession.ServerVersion).Revision -ge 4)) { $ishBackgroundTaskIshObjectsParameter = Add-IshBackgroundTask -EventType $ishEventTypeToPurge -IshObject $ishObjects - $ishBackgroundTaskIshObjectsParameter.Count | Should -BeExactly 1 - $ishBackgroundTaskIshObjectsParameter.GetType() | Should -BeExactly Trisoft.ISHRemote.Objects.Public.IshBackgroundTask - $ishBackgroundTaskIshObjectsParameter.EventType | Should -BeExactly $ishEventTypeToPurge - $ishBackgroundTaskIshObjectsParameter.userid | Should -BeExactly $ishSession.UserName + $ishBackgroundTaskIshObjectsParameter.Count | Should-Be 1 + $ishBackgroundTaskIshObjectsParameter | Should-HaveType Trisoft.ISHRemote.Objects.Public.IshBackgroundTask + $ishBackgroundTaskIshObjectsParameter.EventType | Should-BeString -CaseSensitive $ishEventTypeToPurge + $ishBackgroundTaskIshObjectsParameter.userid | Should-BeString -CaseSensitive $ishSession.UserName } } } @@ -79,28 +79,28 @@ Describe "Add-IshBackgroundTask" -Tags "Create" { } It "Add-IshBackgroundTask returns IshBackgroundTask object" { if (([Version]$ishSession.ServerVersion).Major -ge 15 -or (([Version]$ishSession.ServerVersion).Major -ge 14 -and ([Version]$ishSession.ServerVersion).Revision -ge 4)) { - $ishObjects.Count | Should -BeExactly 10 - $ishBackgroundTaskIshObjectsPipeline.Count | Should -BeExactly 1 - $ishBackgroundTaskIshObjectsPipeline.GetType().Name | Should -BeExactly "IshBackgroundTask" - $ishBackgroundTaskIshObjectsPipeline.EventType | Should -BeExactly $ishEventTypeToPurge - $ishBackgroundTaskIshObjectsPipeline.userid | Should -BeExactly $ishSession.UserName + $ishObjects.Count | Should-Be 10 + $ishBackgroundTaskIshObjectsPipeline.Count | Should-Be 1 + $ishBackgroundTaskIshObjectsPipeline.GetType().Name | Should-BeString -CaseSensitive "IshBackgroundTask" + $ishBackgroundTaskIshObjectsPipeline.EventType | Should-BeString -CaseSensitive $ishEventTypeToPurge + $ishBackgroundTaskIshObjectsPipeline.userid | Should-BeString -CaseSensitive $ishSession.UserName } } It "Pipeline IshObject Single" { if (([Version]$ishSession.ServerVersion).Major -ge 15 -or (([Version]$ishSession.ServerVersion).Major -ge 14 -and ([Version]$ishSession.ServerVersion).Revision -ge 4)) { $ishBackgroundTaskIshObjectsPipeline = $ishObjectTopic1_1 | Add-IshBackgroundTask -IshSession $ishSession -EventType $ishEventTypeToPurge - $ishObjectTopic1_1.Count | Should -BeExactly 1 - $ishBackgroundTaskIshObjectsPipeline.Count | Should -BeExactly 1 - $ishBackgroundTaskIshObjectsPipeline.GetType().Name | Should -BeExactly "IshBackgroundTask" - $ishBackgroundTaskIshObjectsPipeline.EventType | Should -BeExactly $ishEventTypeToPurge - $ishBackgroundTaskIshObjectsPipeline.userid | Should -BeExactly $ishSession.UserName + $ishObjectTopic1_1.Count | Should-Be 1 + $ishBackgroundTaskIshObjectsPipeline.Count | Should-Be 1 + $ishBackgroundTaskIshObjectsPipeline.GetType().Name | Should-BeString -CaseSensitive "IshBackgroundTask" + $ishBackgroundTaskIshObjectsPipeline.EventType | Should-BeString -CaseSensitive $ishEventTypeToPurge + $ishBackgroundTaskIshObjectsPipeline.userid | Should-BeString -CaseSensitive $ishSession.UserName } } It "Pipeline IshObject MetadataBatchSize[10] with LogicalId grouping" { if (([Version]$ishSession.ServerVersion).Major -ge 15 -or (([Version]$ishSession.ServerVersion).Major -ge 14 -and ([Version]$ishSession.ServerVersion).Revision -ge 4)) { $ishSession.MetadataBatchSize = 10 $ishBackgroundTasks = $ishObjects | Add-IshBackgroundTask -IshSession $ishSession -EventType $ishEventTypeToPurge - $ishBackgroundTasks.Count | Should -BeExactly 1 + $ishBackgroundTasks.Count | Should-Be 1 } } AfterAll { @@ -117,7 +117,7 @@ Describe "Add-IshBackgroundTask" -Tags "Create" { # Get-IshBackgroundTask is called to get the system field 'INPUTDATAID' $backgroundTask = $ishObjects | Add-IshBackgroundTask -IshSession $ishSession -EventType $ishEventTypeToPurge -InputDataTemplate IshObjectsWithLngRef | Get-IshBackgroundTask -IshSession $ishSession -RequestedMetadata $requestedMetadata - $backgroundTask.INPUTDATAID -ge 0 | Should -Be $true + $backgroundTask.INPUTDATAID -ge 0 | Should-Be $true # inputData looks like ... $inputData = $ishSession.BackgroundTask25.RetrieveDataObjectByIshDataRefs($backgroundTask.INPUTDATAID) @@ -127,14 +127,14 @@ Describe "Add-IshBackgroundTask" -Tags "Create" { $decodedContent = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($rawCdataContent)) $ishObjectsFromInputData = [xml]$decodedContent - $ishObjectsFromInputData.ishObjects -ne $null | Should -Be $true - $ishObjectsFromInputData.ishobjects.ChildNodes.Count | Should -Be $ishObjects.LngRef.Count # all language cards are passed - $ishObjectsFromInputData.ishObjects.ishObject.Count -ge 0 | Should -Be $true - $ishObjectsFromInputData.ishObjects.ishObject[0].ishtype -ne $null | Should -Be $true - $ishObjectsFromInputData.ishObjects.ishObject[0].ishref -ne $null | Should -Be $true - $ishObjectsFromInputData.ishObjects.ishObject[0].ishlogicalref -ne $null | Should -Be $true - $ishObjectsFromInputData.ishObjects.ishObject[0].ishversionref -ne $null | Should -Be $true - $ishObjectsFromInputData.ishObjects.ishObject[0].ishlngref -ne $null | Should -Be $true + $ishObjectsFromInputData.ishObjects -ne $null | Should-Be $true + $ishObjectsFromInputData.ishobjects.ChildNodes.Count | Should-Be $ishObjects.LngRef.Count # all language cards are passed + $ishObjectsFromInputData.ishObjects.ishObject.Count -ge 0 | Should-Be $true + $ishObjectsFromInputData.ishObjects.ishObject[0].ishtype -ne $null | Should-Be $true + $ishObjectsFromInputData.ishObjects.ishObject[0].ishref -ne $null | Should-Be $true + $ishObjectsFromInputData.ishObjects.ishObject[0].ishlogicalref -ne $null | Should-Be $true + $ishObjectsFromInputData.ishObjects.ishObject[0].ishversionref -ne $null | Should-Be $true + $ishObjectsFromInputData.ishObjects.ishObject[0].ishlngref -ne $null | Should-Be $true } } It "Pipeline IshObject with InputDataTemplate IshObjectWithLngRef" { @@ -142,7 +142,7 @@ Describe "Add-IshBackgroundTask" -Tags "Create" { # Get-IshBackgroundTask is called to get the system field 'INPUTDATAID' $backgroundTask = Add-IshBackgroundTask -IshSession $ishSession -EventType $ishEventTypeToPurge -InputDataTemplate IshObjectWithLngRef -IshObject $ishObjectTopic1_1 | Get-IshBackgroundTask -IshSession $ishSession -RequestedMetadata $requestedMetadata - $backgroundTask.INPUTDATAID -ge 0 | Should -Be $true + $backgroundTask.INPUTDATAID -ge 0 | Should-Be $true # inputData looks like or $inputData = $ishSession.BackgroundTask25.RetrieveDataObjectByIshDataRefs($backgroundTask.INPUTDATAID) @@ -152,13 +152,13 @@ Describe "Add-IshBackgroundTask" -Tags "Create" { $decodedContent = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($rawCdataContent)) $ishObjectFromInputData = [xml]$decodedContent - $ishObjectFromInputData.ChildNodes.Count | Should -Be 1 # first-and-only IshObject will be passed - $ishObjectFromInputData.ishObject -ne $null | Should -Be $true - $ishObjectFromInputData.ishObject.ishtype | Should -Be "ISHModule" - $ishObjectFromInputData.ishObject.ishref | Should -Be "ISHREMOTE-LOGICALID-TOPIC-FORADDBT1" - $ishObjectFromInputData.ishObject.ishlogicalref -ne $null | Should -Be $true - $ishObjectFromInputData.ishObject.ishversionref -ne $null | Should -Be $true - $ishObjectFromInputData.ishObject.ishlngref -ne $null | Should -Be $true + $ishObjectFromInputData.ChildNodes.Count | Should-Be 1 # first-and-only IshObject will be passed + $ishObjectFromInputData.ishObject -ne $null | Should-Be $true + $ishObjectFromInputData.ishObject.ishtype | Should-Be "ISHModule" + $ishObjectFromInputData.ishObject.ishref | Should-Be "ISHREMOTE-LOGICALID-TOPIC-FORADDBT1" + $ishObjectFromInputData.ishObject.ishlogicalref -ne $null | Should-Be $true + $ishObjectFromInputData.ishObject.ishversionref -ne $null | Should-Be $true + $ishObjectFromInputData.ishObject.ishlngref -ne $null | Should-Be $true } } It "Pipeline IshObject with InputDataTemplate IshObjectsWithIshRef" { @@ -169,7 +169,7 @@ Describe "Add-IshBackgroundTask" -Tags "Create" { # Get-IshBackgroundTask is called to get the system field 'INPUTDATAID' $backgroundTask = $localIshObjects | Add-IshBackgroundTask -IshSession $ishSession -EventType $ishEventTypeToPurge -InputDataTemplate IshObjectsWithIshRef | Get-IshBackgroundTask -IshSession $ishSession -RequestedMetadata $requestedMetadata - $backgroundTask.INPUTDATAID -ge 0 | Should -Be $true + $backgroundTask.INPUTDATAID -ge 0 | Should-Be $true # inputData looks like ... $inputData = $ishSession.BackgroundTask25.RetrieveDataObjectByIshDataRefs($backgroundTask.INPUTDATAID) @@ -179,14 +179,14 @@ Describe "Add-IshBackgroundTask" -Tags "Create" { $decodedContent = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($rawCdataContent)) $ishObjectsFromInputData = [xml]$decodedContent - $ishObjectsFromInputData.ishObjects -ne $null | Should -Be $true - $ishObjectsFromInputData.ishobjects.ChildNodes.Count | Should -Be ($ishObjects.IshRef | Select-Object -Unique).Count # all unique LogicalIds are passed - $ishObjectsFromInputData.ishObjects.ishObject.Count -ge 0 | Should -Be $true - $ishObjectsFromInputData.ishObjects.ishObject[0].ishtype -ne $null | Should -Be $true - $ishObjectsFromInputData.ishObjects.ishObject[0].ishref -ne $null | Should -Be $true - $ishObjectsFromInputData.ishObjects.ishObject[0].ishlogicalref -eq $null | Should -Be $true - $ishObjectsFromInputData.ishObjects.ishObject[0].ishversionref -eq $null | Should -Be $true - $ishObjectsFromInputData.ishObjects.ishObject[0].ishlngref -eq $null | Should -Be $true + $ishObjectsFromInputData.ishObjects -ne $null | Should-Be $true + $ishObjectsFromInputData.ishobjects.ChildNodes.Count | Should-Be ($ishObjects.IshRef | Select-Object -Unique).Count # all unique LogicalIds are passed + $ishObjectsFromInputData.ishObjects.ishObject.Count -ge 0 | Should-Be $true + $ishObjectsFromInputData.ishObjects.ishObject[0].ishtype -ne $null | Should-Be $true + $ishObjectsFromInputData.ishObjects.ishObject[0].ishref -ne $null | Should-Be $true + $ishObjectsFromInputData.ishObjects.ishObject[0].ishlogicalref -eq $null | Should-Be $true + $ishObjectsFromInputData.ishObjects.ishObject[0].ishversionref -eq $null | Should-Be $true + $ishObjectsFromInputData.ishObjects.ishObject[0].ishlngref -eq $null | Should-Be $true } } It "Pipeline IShObject with InputDataTemplate IshObjectsWithIshRef over Folder25.GetContents [SCTCM-3506]" { @@ -209,7 +209,7 @@ Describe "Add-IshBackgroundTask" -Tags "Create" { # Get-IshBackgroundTask is called to get the system field 'INPUTDATAID' $backgroundTask = $localIshObjects | Add-IshBackgroundTask -IshSession $ishSession -EventType $ishEventTypeToPurge -InputDataTemplate IshObjectsWithIshRef | Get-IshBackgroundTask -IshSession $ishSession -RequestedMetadata $requestedMetadata - $backgroundTask.INPUTDATAID -ge 0 | Should -Be $true + $backgroundTask.INPUTDATAID -ge 0 | Should-Be $true # inputData looks like ... $inputData = $ishSession.BackgroundTask25.RetrieveDataObjectByIshDataRefs($backgroundTask.INPUTDATAID) @@ -219,14 +219,14 @@ Describe "Add-IshBackgroundTask" -Tags "Create" { $decodedContent = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($rawCdataContent)) $ishObjectsFromInputData = [xml]$decodedContent - $ishObjectsFromInputData.ishObjects -ne $null | Should -Be $true - $ishObjectsFromInputData.ishobjects.ChildNodes.Count | Should -Be ($ishObjects.IshRef | Select-Object -Unique).Count # all unique LogicalIds are passed - $ishObjectsFromInputData.ishObjects.ishObject.Count -ge 0 | Should -Be $true - $ishObjectsFromInputData.ishObjects.ishObject[0].ishtype -ne $null | Should -Be $true - $ishObjectsFromInputData.ishObjects.ishObject[0].ishref -ne $null | Should -Be $true - $ishObjectsFromInputData.ishObjects.ishObject[0].ishlogicalref -eq $null | Should -Be $true - $ishObjectsFromInputData.ishObjects.ishObject[0].ishversionref -eq $null | Should -Be $true - $ishObjectsFromInputData.ishObjects.ishObject[0].ishlngref -eq $null | Should -Be $true + $ishObjectsFromInputData.ishObjects -ne $null | Should-Be $true + $ishObjectsFromInputData.ishobjects.ChildNodes.Count | Should-Be ($ishObjects.IshRef | Select-Object -Unique).Count # all unique LogicalIds are passed + $ishObjectsFromInputData.ishObjects.ishObject.Count -ge 0 | Should-Be $true + $ishObjectsFromInputData.ishObjects.ishObject[0].ishtype -ne $null | Should-Be $true + $ishObjectsFromInputData.ishObjects.ishObject[0].ishref -ne $null | Should-Be $true + $ishObjectsFromInputData.ishObjects.ishObject[0].ishlogicalref -eq $null | Should-Be $true + $ishObjectsFromInputData.ishObjects.ishObject[0].ishversionref -eq $null | Should-Be $true + $ishObjectsFromInputData.ishObjects.ishObject[0].ishlngref -eq $null | Should-Be $true } } It "Pipeline IShObject with InputDataTemplate EventDataWithIshLngRefs, typically skipped to avoid server file artefacts" -Skip { @@ -237,7 +237,7 @@ Describe "Add-IshBackgroundTask" -Tags "Create" { # Get-IshBackgroundTask is called to get the system field 'INPUTDATAID' $backgroundTask = $ishObjects | Add-IshBackgroundTask -IshSession $ishSession -EventType "FOLDEREXPORT" -InputDataTemplate EventDataWithIshLngRefs | Get-IshBackgroundTask -IshSession $ishSession -RequestedMetadata $requestedMetadata - $backgroundTask.INPUTDATAID -ge 0 | Should -Be $true + $backgroundTask.INPUTDATAID -ge 0 | Should-Be $true # inputData looks like 13043819, 13058357, 14246721, 13058260, decided to drop optional $inputData = $ishSession.BackgroundTask25.RetrieveDataObjectByIshDataRefs($backgroundTask.INPUTDATAID) @@ -247,8 +247,8 @@ Describe "Add-IshBackgroundTask" -Tags "Create" { $decodedContent = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($rawCdataContent)) $eventdataFromInputData = [xml]$decodedContent - $eventdataFromInputData.eventdata -ne $null | Should -Be $true - $eventdataFromInputData.eventdata.lngcardids -ne $null | Should -Be $true + $eventdataFromInputData.eventdata -ne $null | Should-Be $true + $eventdataFromInputData.eventdata.lngcardids -ne $null | Should-Be $true } } } @@ -261,19 +261,19 @@ Describe "Add-IshBackgroundTask" -Tags "Create" { $ishBackgroundTaskParameters = Add-IshBackgroundTask -EventType $ishEventTypeToPurge -EventDescription $eventDescription -RawInputData $rawData } It "Add-IshBackgroundTask returns IshBackgroundTask object" { - $ishBackgroundTaskParameters.Count | Should -BeExactly 1 - $ishBackgroundTaskParameters.GetType().Name | Should -BeExactly "IshBackgroundTask" - $ishBackgroundTaskParameters.EventType | Should -BeExactly $ishEventTypeToPurge - $ishBackgroundTaskParameters.userid | Should -BeExactly $ishSession.UserName + $ishBackgroundTaskParameters.Count | Should-Be 1 + $ishBackgroundTaskParameters.GetType().Name | Should-BeString -CaseSensitive "IshBackgroundTask" + $ishBackgroundTaskParameters.EventType | Should-BeString -CaseSensitive $ishEventTypeToPurge + $ishBackgroundTaskParameters.userid | Should-BeString -CaseSensitive $ishSession.UserName } It "Parameter EventDescription null" { - { Add-IshBackgroundTask -EventType $ishEventTypeToPurge -EventDescription $null -RawInputData $rawData } | Should -Throw + { Add-IshBackgroundTask -EventType $ishEventTypeToPurge -EventDescription $null -RawInputData $rawData } | Should-Throw } It "Parameter EventType null" { - { Add-IshBackgroundTask -EventType $null -EventDescription $eventDescription -RawInputData $rawData } | Should -Throw + { Add-IshBackgroundTask -EventType $null -EventDescription $eventDescription -RawInputData $rawData } | Should-Throw } It "Parameter RawInputData null" { - { Add-IshBackgroundTask -EventType $ishEventTypeToPurge -EventDescription $eventDescription -RawInputData $null } | Should -Throw + { Add-IshBackgroundTask -EventType $ishEventTypeToPurge -EventDescription $eventDescription -RawInputData $null } | Should-Throw } It "Parameter StartAfter Tommorrow" { $dateTomorrow = (Get-Date).AddDays(1) @@ -283,25 +283,25 @@ Describe "Add-IshBackgroundTask" -Tags "Create" { +" CultureInfo.Name["+([System.Globalization.CultureInfo]::CurrentCulture).Name+"]" ` +" CultureInfo...ShortDatePattern["+([System.Globalization.CultureInfo]::CurrentCulture).DateTimeFormat.ShortDatePattern+"]" $ishBackgroundTaskStartsAfter = Add-IshBackgroundTask -EventType $ishEventTypeToPurge -EventDescription $eventDescription -RawInputData $rawData -StartAfter $dateTomorrow - $ishBackgroundTaskStartsAfter.Count | Should -BeExactly 1 - ($ishBackgroundTaskStartsAfter.executeafterdate -eq $ishBackgroundTaskStartsAfter.creationdate) | Should -Be $false - $ishBackgroundTaskStartsAfter.GetType().Name | Should -BeExactly "IshBackgroundTask" - $ishBackgroundTaskStartsAfter.EventType | Should -BeExactly $ishEventTypeToPurge - $ishBackgroundTaskStartsAfter.userid | Should -BeExactly $ishSession.UserName + $ishBackgroundTaskStartsAfter.Count | Should-Be 1 + ($ishBackgroundTaskStartsAfter.executeafterdate -eq $ishBackgroundTaskStartsAfter.creationdate) | Should-Be $false + $ishBackgroundTaskStartsAfter.GetType().Name | Should-BeString -CaseSensitive "IshBackgroundTask" + $ishBackgroundTaskStartsAfter.EventType | Should-BeString -CaseSensitive $ishEventTypeToPurge + $ishBackgroundTaskStartsAfter.userid | Should-BeString -CaseSensitive $ishSession.UserName # Verify returned submitted IshBackgroundTask.StartsAfter date matches provided tomorrow StartsAfter - $ishBackgroundTaskStartsAfter.executeafterdate -like "*-*-*T*:*:*" | Should -Be $true - $ishBackgroundTaskStartsAfter.executeafterdate.Substring(0, 11) | Should -Be ($dateTomorrow.ToString("yyyy-MM-ddT")) + $ishBackgroundTaskStartsAfter.executeafterdate -like "*-*-*T*:*:*" | Should-Be $true + $ishBackgroundTaskStartsAfter.executeafterdate.Substring(0, 11) | Should-Be ($dateTomorrow.ToString("yyyy-MM-ddT")) $retrievedExecuteAfter = New-Object DateTime $conversionResult = [DateTime]::TryParseExact($ishBackgroundTaskStartsAfter.executeafterdate, "yyyy-MM-ddTHH:mm:ss", [System.Globalization.CultureInfo]::InvariantCulture, [System.Globalization.DateTimeStyles]::None, [ref]$retrievedExecuteAfter) - $conversionResult | Should -BeExactly $true - $retrievedExecuteAfter.Year | Should -Be $dateTomorrow.Year - $retrievedExecuteAfter.Month | Should -Be $dateTomorrow.Month - $retrievedExecuteAfter.Day | Should -Be $dateTomorrow.Day + $conversionResult | Should-BeTrue + $retrievedExecuteAfter.Year | Should-Be $dateTomorrow.Year + $retrievedExecuteAfter.Month | Should-Be $dateTomorrow.Month + $retrievedExecuteAfter.Day | Should-Be $dateTomorrow.Day # Hour and Minute check are skipped; if Client and Server are in different timezone, you get different hours or minutes back - # $retrievedExecuteAfter.Hour | Should -Be $dateTomorrow.Hour - # $retrievedExecuteAfter.Minute | Should -Be $dateTomorrow.Minute - $retrievedExecuteAfter.Second | Should -Be $dateTomorrow.Second - $retrievedExecuteAfter.ToString("dd/MM/yyyy") | Should -BeExactly $dateTomorrow.ToString("dd/MM/yyyy") + # $retrievedExecuteAfter.Hour | Should-Be $dateTomorrow.Hour + # $retrievedExecuteAfter.Minute | Should-Be $dateTomorrow.Minute + $retrievedExecuteAfter.Second | Should-Be $dateTomorrow.Second + $retrievedExecuteAfter.ToString("dd/MM/yyyy") | Should-BeString -CaseSensitive $dateTomorrow.ToString("dd/MM/yyyy") } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/BackgroundTask/GetIshBackgroundTask.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/BackgroundTask/GetIshBackgroundTask.Tests.ps1 index ffdf5ef..0926df8 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/BackgroundTask/GetIshBackgroundTask.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/BackgroundTask/GetIshBackgroundTask.Tests.ps1 @@ -123,82 +123,82 @@ Describe "Get-IshBackgroundTask" -Tags "Create" { $ishBackgroundTask = (GetBackgroundTasks -ishSession $ishSession -userFilter All -requestedMetadata $metadata)[0] } It "GetType().Name" { - $ishBackgroundTask.GetType().Name | Should -BeExactly "IshBackgroundTask" + $ishBackgroundTask.GetType().Name | Should-BeString -CaseSensitive "IshBackgroundTask" } It "ishObject.IshField" { - $ishBackgroundTask.IshField | Should -Not -BeNullOrEmpty + $ishBackgroundTask.IshField | Should-NotBeNull } It "ishObject.IshRef" { - $ishBackgroundTask.IshRef | Should -Not -BeNullOrEmpty + $ishBackgroundTask.IshRef | Should-NotBeNull } # Double check following 2 ReferenceType enum usage It "ishBackgroundTask.TaskRef" { - $ishBackgroundTask.TaskRef | Should -Not -BeNullOrEmpty + $ishBackgroundTask.TaskRef | Should-NotBeNull } #It "ishBackgroundTask.HistoryRef" { - # $ishBackgroundTask.HistoryRef | Should -Not -BeNullOrEmpty + # $ishBackgroundTask.HistoryRef | Should-NotBeNull #} It "ishBackgroundTask ConvertTo-Json" { - (ConvertTo-Json $ishBackgroundTask).Length -gt 2 | Should -Be $true + (ConvertTo-Json $ishBackgroundTask).Length -gt 2 | Should-Be $true } It "Parameter IshSession/ModifiedSince/UserFilter invalid" { - { Get-IshBackgroundTask -IShSession "INVALIDISHSESSION" -ModifiedSince "INVALIDDATE" -UserFilter "INVALIDUSERFILTER" } | Should -Throw + { Get-IshBackgroundTask -IShSession "INVALIDISHSESSION" -ModifiedSince "INVALIDDATE" -UserFilter "INVALIDUSERFILTER" } | Should-Throw } It "Parameter RequestedMetadata/MetadataFile invalid" { - { Get-IshBackgroundTask -IShSession $ishSession -RequestedMetadata "INVALIDMETADATA" -MetadataFilter "INVALIDFILTER" } | Should -Throw + { Get-IshBackgroundTask -IShSession $ishSession -RequestedMetadata "INVALIDMETADATA" -MetadataFilter "INVALIDFILTER" } | Should-Throw } It "Parameter IshSession/UserFilter/MetadataFilter are optional" { $ishBackgroundTask = (GetBackgroundTasks -ishSession $ishSession -requestedMetadata $allTaskMetadata)[0] - ($ishBackgroundTask | Get-IshMetadataField -IshSession $ishSession -Level Task -Name USERID -ValueType Element).StartsWith('VUSER') | Should -Be $true - ($ishBackgroundTask | Get-IshMetadataField -IshSession $ishSession -Level Task -Name STATUS -ValueType Element).StartsWith('VBACKGROUNDTASK') | Should -Be $true + ($ishBackgroundTask | Get-IshMetadataField -IshSession $ishSession -Level Task -Name USERID -ValueType Element).StartsWith('VUSER') | Should-Be $true + ($ishBackgroundTask | Get-IshMetadataField -IshSession $ishSession -Level Task -Name STATUS -ValueType Element).StartsWith('VBACKGROUNDTASK') | Should-Be $true } It "Option IshSession.DefaultRequestedMetadata" { $oldDefaultRequestedMetadata = $ishSession.DefaultRequestedMetadata $ishSession.DefaultRequestedMetadata = "Descriptive" $ishBackgroundTask = (GetBackgroundTasks -ishSession $ishSession)[0] - (($ishBackgroundTask.IshField.Count -eq 1) -or ($ishBackgroundTask.IshField.Count -eq 2)) | Should -Be $true # Either BackgroundTask has run and you get taskid/historyid, or it didn't and you only get taskid + (($ishBackgroundTask.IshField.Count -eq 1) -or ($ishBackgroundTask.IshField.Count -eq 2)) | Should-Be $true # Either BackgroundTask has run and you get taskid/historyid, or it didn't and you only get taskid $ishSession.DefaultRequestedMetadata = "Basic" $ishBackgroundTask = (GetBackgroundTasks -ishSession $ishSession)[0] - $ishBackgroundTask.status.Length -ge 1 | Should -Be $true - $ishBackgroundTask.status_task_element.StartsWith('VBACKGROUNDTASKSTATUS') | Should -Be $true - (($ishBackgroundTask.IshField.Count -eq 13) -or ($ishBackgroundTask.IshField.Count -eq 20)) | Should -Be $true + $ishBackgroundTask.status.Length -ge 1 | Should-Be $true + $ishBackgroundTask.status_task_element.StartsWith('VBACKGROUNDTASKSTATUS') | Should-Be $true + (($ishBackgroundTask.IshField.Count -eq 13) -or ($ishBackgroundTask.IshField.Count -eq 20)) | Should-Be $true $ishSession.DefaultRequestedMetadata = "All" $ishBackgroundTask = (GetBackgroundTasks -ishSession $ishSession)[0] - (($ishBackgroundTask.IshField.Count -eq 18) -or ($ishBackgroundTask.IshField.Count -eq 27)) | Should -Be $true + (($ishBackgroundTask.IshField.Count -eq 18) -or ($ishBackgroundTask.IshField.Count -eq 27)) | Should-Be $true $ishSession.DefaultRequestedMetadata = $oldDefaultRequestedMetadata } It "Parameter ModifiedSince is now" { # a date in the future should yield no results - (Get-IshBackgroundTask -IshSession $ishSession -ModifiedSince ((Get-Date).AddMinutes(1)) -UserFilter All).Count | Should -Be 0 + (Get-IshBackgroundTask -IshSession $ishSession -ModifiedSince ((Get-Date).AddMinutes(1)) -UserFilter All).Count | Should-Be 0 } It "Parameter RequestedMetadata only all of Task level" { $ishBackgroundTask = (GetBackgroundTasks -ishSession $ishSession -userFilter All -requestedMetadata $allTaskMetadata)[0] - $ishBackgroundTask.TaskRef -gt 0 | Should -Be $true - $ishBackgroundTask.IshField.Count -ge 16 | Should -Be $true + $ishBackgroundTask.TaskRef -gt 0 | Should-Be $true + $ishBackgroundTask.IshField.Count -ge 16 | Should-Be $true } It "Parameter RequestedMetadata only all of History level" { $ishBackgroundTask = (GetBackgroundTasks -ishSession $ishSession -userFilter All -requestedMetadata $allHistMetadata)[0] - $ishBackgroundTask.TaskRef -gt 0 | Should -Be $true - #$ishBackgroundTask.HistoryRef -gt 0 | Should -Be $true - $ishBackgroundTask.IshField.Count -ge 1 | Should -Be $true # At least 1 entries returned if BackgroundTask service is not running, otherwise more + $ishBackgroundTask.TaskRef -gt 0 | Should-Be $true + #$ishBackgroundTask.HistoryRef -gt 0 | Should-Be $true + $ishBackgroundTask.IshField.Count -ge 1 | Should-Be $true # At least 1 entries returned if BackgroundTask service is not running, otherwise more } It "Parameter RequestedMetadata PipelineObjectPreference=PSObjectNoteProperty" { - $ishSession.PipelineObjectPreference | Should -Be "PSObjectNoteProperty" + $ishSession.PipelineObjectPreference | Should-Be "PSObjectNoteProperty" $ishBackgroundTask = (GetBackgroundTasks -ishSession $ishSession -userFilter All -requestedMetadata $allMetadata)[0] - $ishBackgroundTask.GetType().Name | Should -BeExactly "IshBackgroundTask" # and not PSObject - [bool]($ishBackgroundTask.PSobject.Properties.name -match "status_task_element") | Should -Be $true - [bool]($ishBackgroundTask.PSobject.Properties.name -match "userid_task_element") | Should -Be $true - [bool]($ishBackgroundTask.PSobject.Properties.name -match "modificationdate") | Should -Be $true - $ishBackgroundTask.modificationdate -like "*/*" | Should -Be $false # It should be sortable date format: yyyy-MM-ddTHH:mm:ss + $ishBackgroundTask.GetType().Name | Should-BeString -CaseSensitive "IshBackgroundTask" # and not PSObject + [bool]($ishBackgroundTask.PSobject.Properties.name -match "status_task_element") | Should-Be $true + [bool]($ishBackgroundTask.PSobject.Properties.name -match "userid_task_element") | Should-Be $true + [bool]($ishBackgroundTask.PSobject.Properties.name -match "modificationdate") | Should-Be $true + $ishBackgroundTask.modificationdate -like "*/*" | Should-Be $false # It should be sortable date format: yyyy-MM-ddTHH:mm:ss } It "Parameter RequestedMetadata PipelineObjectPreference=Off" { $pipelineObjectPreference = $ishSession.PipelineObjectPreference $ishSession.PipelineObjectPreference = "Off" $ishBackgroundTask = (GetBackgroundTasks -ishSession $ishSession -userFilter All -requestedMetadata $allMetadata)[0] - $ishBackgroundTask.GetType().Name | Should -BeExactly "IshBackgroundTask" - [bool]($ishBackgroundTask.PSobject.Properties.name -match "status_task_element") | Should -Be $false - [bool]($ishBackgroundTask.PSobject.Properties.name -match "userid_task_element") | Should -Be $false - [bool]($ishBackgroundTask.PSobject.Properties.name -match "modificationdate") | Should -Be $false + $ishBackgroundTask.GetType().Name | Should-BeString -CaseSensitive "IshBackgroundTask" + [bool]($ishBackgroundTask.PSobject.Properties.name -match "status_task_element") | Should-Be $false + [bool]($ishBackgroundTask.PSobject.Properties.name -match "userid_task_element") | Should-Be $false + [bool]($ishBackgroundTask.PSobject.Properties.name -match "modificationdate") | Should-Be $false $ishSession.PipelineObjectPreference = $pipelineObjectPreference } It "Parameter MetadataFilter Filter to exactly one" { @@ -207,18 +207,18 @@ Describe "Get-IshBackgroundTask" -Tags "Create" { Set-IshMetadataFilterField -IshSession $ishSession -Level Task -Name TASKID -ValueType Element -Value ($ishBackgroundTask | Get-IshMetadataField -IshSession $ishSession -Level Task -Name TASKID) $ishBackgroundTaskArray = Get-IshBackgroundTask -IshSession $ishSession -MetadataFilter $filterMetadata #Write-Host ("ishBackgroundTask.IshRef["+ $ishBackgroundTask.IshRef + "] ishBackgroundTaskArray.IshRef["+ $ishBackgroundTask.IshRef + "]") - $ishBackgroundTaskArray.Count -ge 1 | Should -Be $true # earlier on, also filter on HISTORYID, but that is not always filled in, even with the windows service off + $ishBackgroundTaskArray.Count -ge 1 | Should-Be $true # earlier on, also filter on HISTORYID, but that is not always filled in, even with the windows service off } It "Parameter IshBackgroundTask invalid" { - { Get-IshBackgroundTask -IshSession $ishSession -IshBackgroundTask "INVALIDISHBACKGROUNDTASK" } | Should -Throw + { Get-IshBackgroundTask -IshSession $ishSession -IshBackgroundTask "INVALIDISHBACKGROUNDTASK" } | Should-Throw } It "Parameter IshBackgroundTask Single" { $ishBackgroundTask = (GetBackgroundTasks -ishSession $ishSession -userFilter Current -requestedMetadata $metadata)[0] $taskId = $ishBackgroundTask | Get-IshMetadataField -IshSession $ishSession -Level Task -Name TASKID $ishBackgroundTaskArray = Get-IshBackgroundTask -IshSession $ishSession -IshBackgroundTask $ishBackgroundTask - $ishBackgroundTaskArray.Count -ge 1 | Should -Be $true + $ishBackgroundTaskArray.Count -ge 1 | Should-Be $true foreach ($task in $ishBackgroundTaskArray) { - $task.IshRef | Should -Be $taskId + $task.IshRef | Should-Be $taskId } } <# TODO [Could] It "Parameter IshBackgroundTask Multiple" { @@ -228,9 +228,9 @@ Describe "Get-IshBackgroundTask" -Tags "Create" { $ishBackgroundTask = (GetBackgroundTasks -ishSession $ishSession -userFilter Current -requestedMetadata $metadata)[0] $taskId = $ishBackgroundTask | Get-IshMetadataField -IshSession $ishSession -Level Task -Name TASKID $ishBackgroundTaskArray = $ishBackgroundTask | Get-IshBackgroundTask -IshSession $ishSession - $ishBackgroundTaskArray.Count -ge 1 | Should -Be $true + $ishBackgroundTaskArray.Count -ge 1 | Should-Be $true foreach ($task in $ishBackgroundTaskArray) { - $task.IshRef | Should -Be $taskId + $task.IshRef | Should-Be $taskId } } <# TODO [Could] It "Pipeline IshBackgroundTask Multiple" { diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/AddIshBasline.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/AddIshBasline.Tests.ps1 index 7f24c0b..c9753a4 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/AddIshBasline.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/AddIshBasline.Tests.ps1 @@ -9,26 +9,26 @@ BeforeAll { Describe "Add-IshBaseline" -Tags "Create" { Context "Add-IshBaseline ParameterGroup" { It "Parameter IshSession invalid" { - { Add-IshBaseline -IShSession "INVALIDISHSESSION" -Name "INVALIDBASELINENAME" } | Should -Throw + { Add-IshBaseline -IShSession "INVALIDISHSESSION" -Name "INVALIDBASELINENAME" } | Should-Throw } } Context "Add-IshBaseline ParameterGroup" { It "GetType().Name" { $baselineName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " Name") $ishObject = Add-IshBaseline -Name $baselineName - (Get-IshMetadataField -IshObject $ishObject -Level None -Name "FISHDOCUMENTRELEASE").Length -gt 0 | Should -Be $true - $ishObject.GetType().Name | Should -BeExactly "IshBaseline" - $ishObject.Count | Should -Be 1 + (Get-IshMetadataField -IshObject $ishObject -Level None -Name "FISHDOCUMENTRELEASE").Length -gt 0 | Should-Be $true + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshBaseline" + $ishObject.Count | Should-Be 1 } It "GetType().Name with optional IshSession" { $baselineName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " Name") $ishObject = Add-IshBaseline -IshSession $ishSession -Name $baselineName - (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Level None -Name "FISHDOCUMENTRELEASE").Length -gt 0 | Should -Be $true - $ishObject.GetType().Name | Should -BeExactly "IshBaseline" - $ishObject.Count | Should -Be 1 - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" - $ishObject.fishdocumentrelease.Length -ge 1 | Should -Be $true - $ishObject.fishdocumentrelease_none_element.StartsWith('GUID') | Should -Be $true + (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Level None -Name "FISHDOCUMENTRELEASE").Length -gt 0 | Should-Be $true + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshBaseline" + $ishObject.Count | Should-Be 1 + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" + $ishObject.fishdocumentrelease.Length -ge 1 | Should-Be $true + $ishObject.fishdocumentrelease_none_element.StartsWith('GUID') | Should-Be $true } } Context "Add-IshBaseline IshObjectGroup" { @@ -56,27 +56,27 @@ Describe "Add-IshBaseline" -Tags "Create" { Start-Sleep -Milliseconds 1000 # Avoids uniquesness error which only up to the second " Cannot insert duplicate key row in object 'dbo.CARD' with unique index 'CARD_NAME_I1'. The duplicate key value is (...A12/10/2016 16:47:16)." } It "Parameter IshObject invalid" { - { Add-IshBaseline -IShSession $ishSession -IshObject "INVALIDBASELINE" } | Should -Throw + { Add-IshBaseline -IShSession $ishSession -IshObject "INVALIDBASELINE" } | Should-Throw } It "Parameter IshObject Single" { $ishObjects = Add-IshBaseline -IshSession $ishSession -IshObject $ishObjectA $ishObjects | Remove-IshBaseline -IshSession $ishSession - $ishObjects.Count | Should -Be 1 + $ishObjects.Count | Should-Be 1 } It "Parameter IshObject Multiple" { $ishObjects = Add-IshBaseline -IshSession $ishSession -IshObject @($ishObjectB,$ishObjectC) $ishObjects | Remove-IshBaseline -IshSession $ishSession - $ishObjects.Count | Should -Be 2 + $ishObjects.Count | Should-Be 2 } It "Pipeline IshObject Single" { $ishObjects = $ishObjectD | Add-IshBaseline -IshSession $ishSession $ishObjects | Remove-IshBaseline -IshSession $ishSession - $ishObjects.Count | Should -Be 1 + $ishObjects.Count | Should-Be 1 } It "Pipeline IshObject Multiple" { $ishObjects = @($ishObjectE,$ishObjectF) | Add-IshBaseline -IshSession $ishSession $ishObjects | Remove-IshBaseline -IshSession $ishSession - $ishObjects.Count | Should -Be 2 + $ishObjects.Count | Should-Be 2 } } Context "Add-IshBaseline IshObjectGroup" { @@ -103,27 +103,27 @@ Describe "Add-IshBaseline" -Tags "Create" { Start-Sleep -Milliseconds 1000 # Avoids uniquesness error which only up to the second " Cannot insert duplicate key row in object 'dbo.CARD' with unique index 'CARD_NAME_I1'. The duplicate key value is (...A12/10/2016 16:47:16)." } It "Parameter IshObject invalid" { - { Add-IshBaseline -IShSession $ishSession -IshObject "INVALIDBASELINE" } | Should -Throw + { Add-IshBaseline -IShSession $ishSession -IshObject "INVALIDBASELINE" } | Should-Throw } It "Parameter IshObject Single" { $ishObjects = Add-IshBaseline -IshSession $ishSession -IshObject $ishObjectA $ishObjects | Remove-IshBaseline -IshSession $ishSession - $ishObjects.Count | Should -Be 1 + $ishObjects.Count | Should-Be 1 } It "Parameter IshObject Multiple" { $ishObjects = Add-IshBaseline -IshSession $ishSession -IshObject @($ishObjectB,$ishObjectC) $ishObjects | Remove-IshBaseline -IshSession $ishSession - $ishObjects.Count | Should -Be 2 + $ishObjects.Count | Should-Be 2 } It "Pipeline IshObject Single" { $ishObjects = $ishObjectD | Add-IshBaseline -IshSession $ishSession $ishObjects | Remove-IshBaseline -IshSession $ishSession - $ishObjects.Count | Should -Be 1 + $ishObjects.Count | Should-Be 1 } It "Pipeline IshObject Multiple" { $ishObjects = @($ishObjectE,$ishObjectF) | Add-IshBaseline -IshSession $ishSession $ishObjects | Remove-IshBaseline -IshSession $ishSession - $ishObjects.Count | Should -Be 2 + $ishObjects.Count | Should-Be 2 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/FindIshBaseline.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/FindIshBaseline.Tests.ps1 index f6c11fc..9747bf8 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/FindIshBaseline.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/FindIshBaseline.Tests.ps1 @@ -22,7 +22,7 @@ Describe "Find-IshBaseline" -Tags "Read" { } Context "Find-IshBaseline ParameterGroup" { It "Parameter IshSession invalid" { - { Find-IshBaseline -IShSession "INVALIDISHSESSION" } | Should -Throw + { Find-IshBaseline -IShSession "INVALIDISHSESSION" } | Should-Throw } } Context "Find-IshBaseline returns IshBaseline object" { @@ -46,21 +46,21 @@ Describe "Find-IshBaseline" -Tags "Read" { It "Parameter IshSession explicit" { $ishObject = Find-IshBaseline -IShSession $ishSession -RequestedMetadata $requestedMetadata | Where-Object -Property IshRef -EQ -Value $baselineId - $ishObject.GetType().Name | Should -BeExactly "IshBaseline" - $ishObject.IshRef -ge 0 | Should -Be $true - $ishObject.IshType | Should -Not -BeNullOrEmpty - $ishObject.IshField | Should -Not -BeNullOrEmpty - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" - $ishObject.fishdocumentrelease.Length -ge 1 | Should -Be $true - $ishObject.fishdocumentrelease_none_element.StartsWith('GUID') | Should -Be $true + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshBaseline" + $ishObject.IshRef -ge 0 | Should-Be $true + $ishObject.IshType | Should-NotBeNull + $ishObject.IshField | Should-NotBeNull + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" + $ishObject.fishdocumentrelease.Length -ge 1 | Should-Be $true + $ishObject.fishdocumentrelease_none_element.StartsWith('GUID') | Should-Be $true } It "Parameter IshSession/RequestedMetadata implicit" { $ishObject = Find-IshBaseline | Where-Object -Property IshRef -EQ -Value $baselineId - $ishObject.GetType().Name | Should -BeExactly "IshBaseline" - $ishObject.IshRef -ge 0 | Should -Be $true - $ishObject.IshType | Should -Not -BeNullOrEmpty - $ishObject.IshField | Should -Not -BeNullOrEmpty + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshBaseline" + $ishObject.IshRef -ge 0 | Should-Be $true + $ishObject.IshType | Should-NotBeNull + $ishObject.IshField | Should-NotBeNull } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/GetIshBaseline.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/GetIshBaseline.Tests.ps1 index da32048..3066311 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/GetIshBaseline.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/GetIshBaseline.Tests.ps1 @@ -22,7 +22,7 @@ Describe "Get-IshBaseline" -Tags "Read" { } Context "Get-IshBaseline ParameterGroup" { It "Parameter IshSession invalid" { - { Get-IshBaseline -IShSession "INVALIDISHSESSION" } | Should -Throw + { Get-IshBaseline -IShSession "INVALIDISHSESSION" } | Should-Throw } } Context "Get-IshBaseline returns IshBaseline object" { @@ -45,20 +45,20 @@ Describe "Get-IshBaseline" -Tags "Read" { } It "Parameter IshSession explicit" { $ishObject = Get-IshBaseline -IShSession $ishSession -Id $baselineId -RequestedMetadata $requestedMetadata -MetadataFilter $metadataFilter - $ishObject.GetType().Name | Should -BeExactly "IshBaseline" - $ishObject.IshRef -ge 0 | Should -Be $true - $ishObject.IshType | Should -Not -BeNullOrEmpty - $ishObject.IshField | Should -Not -BeNullOrEmpty + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshBaseline" + $ishObject.IshRef -ge 0 | Should-Be $true + $ishObject.IshType | Should-NotBeNull + $ishObject.IshField | Should-NotBeNull } It "Parameter IshSession/RequestedMetadata implicit" { $ishObject = Get-IshBaseline -Id $baselineId -MetadataFilter $metadataFilter - $ishObject.GetType().Name | Should -BeExactly "IshBaseline" - $ishObject.IshRef -ge 0 | Should -Be $true - $ishObject.IshType | Should -Not -BeNullOrEmpty - $ishObject.IshField | Should -Not -BeNullOrEmpty - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" - $ishObject.fishdocumentrelease.Length -ge 1 | Should -Be $true - $ishObject.fishdocumentrelease_none_element.StartsWith('GUID') | Should -Be $true + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshBaseline" + $ishObject.IshRef -ge 0 | Should-Be $true + $ishObject.IshType | Should-NotBeNull + $ishObject.IshField | Should-NotBeNull + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" + $ishObject.fishdocumentrelease.Length -ge 1 | Should-Be $true + $ishObject.fishdocumentrelease_none_element.StartsWith('GUID') | Should-Be $true } } @@ -74,22 +74,22 @@ Describe "Get-IshBaseline" -Tags "Read" { $ishObjectD = Add-IshBaseline -IshSession $ishSession -Name $baselineName } It "Parameter IshObject invalid" { - { Get-IshBaseline -IShSession $ishSession -IshObject "INVALIDBASELINE" } | Should -Throw + { Get-IshBaseline -IShSession $ishSession -IshObject "INVALIDBASELINE" } | Should-Throw } It "Parameter IshObject Single" { - (Get-IshBaseline -IshSession $ishSession -IshObject $ishObjectA).IshRef.Length -ge 0 | Should -Be $true + (Get-IshBaseline -IshSession $ishSession -IshObject $ishObjectA).IshRef.Length -ge 0 | Should-Be $true } It "Parameter IshObject Multiple" { - (Get-IshBaseline -IshSession $ishSession -IshObject @($ishObjectB,$ishObjectC)).Count | Should -Be 2 + (Get-IshBaseline -IshSession $ishSession -IshObject @($ishObjectB,$ishObjectC)).Count | Should-Be 2 } It "Pipeline IshObject Single" { $ishObjects = $ishObjectD | Get-IshBaseline -IshSession $ishSession - $ishObjects.Count | Should -Be 1 + $ishObjects.Count | Should-Be 1 } It "Pipeline IshObject Multiple" { $ishSession.MetadataBatchSize = 2 $ishObjects = @($ishObjectA,$ishObjectB,$ishObjectC,$ishObjectD) | Get-IshBaseline -IshSession $ishSession - $ishObjects.Count | Should -Be 4 + $ishObjects.Count | Should-Be 4 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/GetIshBaselineItem.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/GetIshBaselineItem.Tests.ps1 index 48dccb5..8aca15f 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/GetIshBaselineItem.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/GetIshBaselineItem.Tests.ps1 @@ -9,7 +9,7 @@ BeforeAll { Describe "Get-IshBaselineItem" -Tags "Read" { Context "Get-IshBaselineItem ParameterGroup" { It "Parameter IshSession invalid" { - { Get-IshBaselineItem -IShSession "INVALIDISHSESSION" } | Should -Throw + { Get-IshBaselineItem -IShSession "INVALIDISHSESSION" } | Should-Throw } } Context "Get-IshBaselineItem returns IshBaselineItem object" { @@ -20,27 +20,27 @@ Describe "Get-IshBaselineItem" -Tags "Read" { } It "Parameter IshSession explicit" { $ishBaselineItem = (Get-IshBaselineItem -IShSession $ishSession -IshObject $ishObject)[0] - $ishBaselineItem.GetType().Name | Should -BeExactly "IshBaselineItem" - $ishBaselineItem.IshRef | Should -Not -BeNullOrEmpty - $ishBaselineItem.LogicalId | Should -Not -BeNullOrEmpty - $ishBaselineItem.Version | Should -Not -BeNullOrEmpty - $ishBaselineItem.Author | Should -Not -BeNullOrEmpty - $ishBaselineItem.CreatedOn | Should -Not -BeNullOrEmpty - $ishBaselineItem.CreatedOnAsSortableDateTime | Should -Not -BeNullOrEmpty - $ishBaselineItem.ModifiedOn | Should -Not -BeNullOrEmpty - $ishBaselineItem.ModifiedOnAsSortableDateTime | Should -Not -BeNullOrEmpty + $ishBaselineItem.GetType().Name | Should-BeString -CaseSensitive "IshBaselineItem" + $ishBaselineItem.IshRef | Should-NotBeNull + $ishBaselineItem.LogicalId | Should-NotBeNull + $ishBaselineItem.Version | Should-NotBeNull + $ishBaselineItem.Author | Should-NotBeNull + $ishBaselineItem.CreatedOn | Should-NotBeNull + $ishBaselineItem.CreatedOnAsSortableDateTime | Should-NotBeNull + $ishBaselineItem.ModifiedOn | Should-NotBeNull + $ishBaselineItem.ModifiedOnAsSortableDateTime | Should-NotBeNull } It "Parameter IshSession implicit" { $ishBaselineItem = (Get-IshBaselineItem -IshObject $ishObject)[0] - $ishBaselineItem.GetType().Name | Should -BeExactly "IshBaselineItem" - $ishBaselineItem.IshRef | Should -Not -BeNullOrEmpty - $ishBaselineItem.LogicalId | Should -Not -BeNullOrEmpty - $ishBaselineItem.Version | Should -Not -BeNullOrEmpty - $ishBaselineItem.Author | Should -Not -BeNullOrEmpty - $ishBaselineItem.CreatedOn | Should -Not -BeNullOrEmpty - $ishBaselineItem.CreatedOnAsSortableDateTime | Should -Not -BeNullOrEmpty - $ishBaselineItem.ModifiedOn | Should -Not -BeNullOrEmpty - $ishBaselineItem.ModifiedOnAsSortableDateTime | Should -Not -BeNullOrEmpty + $ishBaselineItem.GetType().Name | Should-BeString -CaseSensitive "IshBaselineItem" + $ishBaselineItem.IshRef | Should-NotBeNull + $ishBaselineItem.LogicalId | Should-NotBeNull + $ishBaselineItem.Version | Should-NotBeNull + $ishBaselineItem.Author | Should-NotBeNull + $ishBaselineItem.CreatedOn | Should-NotBeNull + $ishBaselineItem.CreatedOnAsSortableDateTime | Should-NotBeNull + $ishBaselineItem.ModifiedOn | Should-NotBeNull + $ishBaselineItem.ModifiedOnAsSortableDateTime | Should-NotBeNull } It "ModifiedOn and CreatedOn Sortable Date Converstion #157" { # Note that this test will always pass from day 13 to day 31 of the month because of the parsing fall back, @@ -50,14 +50,14 @@ Describe "Get-IshBaselineItem" -Tags "Read" { $bi = (Get-IshBaselineItem -IshObject $ishObject) # Neutral parsing could lead to DateTime.Min ... # Can happen with ([System.Globalization.CultureInfo]::CurrentCulture).DateTimeFormat.ShortDatePattern = "MM/dd/yyyy" - $bi[0].ModifiedOn | Should -Not -Be "0001-01-01T00:00:00" - $bi[0].ModifiedOnAsSortableDateTime | Should -Not -Be "0001-01-01T00:00:00.0000000" + $bi[0].ModifiedOn | Should-NotBe "0001-01-01T00:00:00" + $bi[0].ModifiedOnAsSortableDateTime | Should-NotBe "0001-01-01T00:00:00.0000000" # Where ModifiedOn is Sunday, August 6, 2023 5:23:45 PM - (Get-Date -Date $bi[0].ModifiedOn).Day | Should -Be $day - (Get-Date -Date $bi[0].ModifiedOn).Month | Should -Be $month + (Get-Date -Date $bi[0].ModifiedOn).Day | Should-Be $day + (Get-Date -Date $bi[0].ModifiedOn).Month | Should-Be $month # Where ModifiedOnAsSortableDateTime is 2023-08-06T17:23:45 which is in the future at the time of writing - $bi[0].ModifiedOnAsSortableDateTime.Substring(5,2) | Should -Be $month - $bi[0].ModifiedOnAsSortableDateTime.Substring(8,2) | Should -Be $day + $bi[0].ModifiedOnAsSortableDateTime.Substring(5,2) | Should-Be $month + $bi[0].ModifiedOnAsSortableDateTime.Substring(8,2) | Should-Be $day } } Context "Get-IshBaselineItem IshObjectGroup" { @@ -80,21 +80,21 @@ Describe "Get-IshBaselineItem" -Tags "Read" { Set-IshBaselineItem -IshSession $ishSession -IshObject $ishObjectD -LogicalId "$cmdletName--DD" -Version "2" } It "Parameter IshObject invalid" { - { Get-IshBaselineItem -IShSession $ishSession -IshObject "INVALIDBASELINE" } | Should -Throw + { Get-IshBaselineItem -IShSession $ishSession -IshObject "INVALIDBASELINE" } | Should-Throw } It "Parameter IshObject Single" { - (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObjectA).Count | Should -Be 2 + (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObjectA).Count | Should-Be 2 } It "Parameter IshObject Multiple" { - (Get-IshBaselineItem -IshSession $ishSession -IshObject @($ishObjectB,$ishObjectC)).Count | Should -Be 4 + (Get-IshBaselineItem -IshSession $ishSession -IshObject @($ishObjectB,$ishObjectC)).Count | Should-Be 4 } It "Pipeline IshObject Single" { $ishBaselineItems = $ishObjectD | Get-IshBaselineItem -IshSession $ishSession - $ishBaselineItems.Count | Should -Be 2 + $ishBaselineItems.Count | Should-Be 2 } It "Pipeline IshObject Multiple" { $ishBaselineItems = @($ishObjectA,$ishObjectB,$ishObjectC,$ishObjectD) | Get-IshBaselineItem -IshSession $ishSession - $ishBaselineItems.Count | Should -Be 8 + $ishBaselineItems.Count | Should-Be 8 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/RemoveIshBaselineItem.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/RemoveIshBaselineItem.Tests.ps1 index 05b2d67..2aeabb4 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/RemoveIshBaselineItem.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/RemoveIshBaselineItem.Tests.ps1 @@ -19,25 +19,25 @@ Describe "Remove-IshBaselineItem" { } It "Parameter IshSession invalid" { - {Remove-IshBaselineItem -IShSession "INVALIDISHSESSION" -IshObject $ishObject -LogicalId "$cmdletName--A"} | Should -Throw + {Remove-IshBaselineItem -IShSession "INVALIDISHSESSION" -IshObject $ishObject -LogicalId "$cmdletName--A"} | Should-Throw } It "GetType()" { - $ishObjectRemove.GetType().Name | Should -BeExactly "IshBaseline" + $ishObjectRemove.GetType().Name | Should-BeString -CaseSensitive "IshBaseline" } It "$ishObject.IshRef" { - $ishObjectRemove.IshRef | Should -Not -BeNullOrEmpty + $ishObjectRemove.IshRef | Should-NotBeNull } It "Remove 1 item" { $ishObjectRemove = Remove-IshBaselineItem -IshSession $ishSession -IshObject $ishObject -LogicalId "$cmdletName--AA" - (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject).Count | Should -Be 1 + (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject).Count | Should-Be 1 } It "Remove the last item" { $ishObjectRemove = Remove-IshBaselineItem -IshSession $ishSession -IshObject $ishObject -LogicalId "$cmdletName--A" - (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject).Count | Should -Be 0 + (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject).Count | Should-Be 0 } } @@ -56,16 +56,16 @@ Describe "Remove-IshBaselineItem" { It "Remove the same item from two baselines" { $ishObjects = Remove-IshBaselineItem -IshSession $ishSession -IshObject @($ishObject1, $ishObject2) -LogicalId "$cmdletName--AA" - (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject1).Count | Should -Be 1 - (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject2).Count | Should -Be 1 - $ishObjects.Count | Should -Be 2 + (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject1).Count | Should-Be 1 + (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject2).Count | Should-Be 1 + $ishObjects.Count | Should-Be 2 } It "Remove item existing only in one of baselines" { $ishObjects = Remove-IshBaselineItem -IshSession $ishSession -IshObject @($ishObject1, $ishObject2) -LogicalId "$cmdletName--A1" - (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject1).Count | Should -Be 0 - (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject2).Count | Should -Be 1 - $ishObjects.Count | Should -Be 2 + (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject1).Count | Should-Be 0 + (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject2).Count | Should-Be 1 + $ishObjects.Count | Should-Be 2 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/SetIshBaseline.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/SetIshBaseline.Tests.ps1 index 79aefe9..0bbbf8b 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/SetIshBaseline.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/SetIshBaseline.Tests.ps1 @@ -9,7 +9,7 @@ BeforeAll { Describe "Set-IshBaseline" -Tags "Create" { Context "Set-IshBaseline ParameterGroup" { It "Parameter IshSession invalid" { - { Set-IshBaseline -IShSession "INVALIDISHSESSION" -Name "INVALIDBASELINENAME" } | Should -Throw + { Set-IshBaseline -IShSession "INVALIDISHSESSION" -Name "INVALIDBASELINENAME" } | Should-Throw } } Context "Set-IshBaseline ParameterGroup" { @@ -18,19 +18,19 @@ Describe "Set-IshBaseline" -Tags "Create" { $ishObject = Add-IshBaseline -IshSession $ishSession -Name $baselineName $metadata = Set-IshMetadataField -IshSession $ishSession -Name "FISHDOCUMENTRELEASE" -Level None -Value "$baselineName RENAMED" $ishObject = Set-IshBaseline -IshSession $ishSession -Id $ishObject.IshRef -Metadata $metadata - $ishObject.GetType().Name | Should -BeExactly "IshBaseline" - $ishObject.Count | Should -Be 1 + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshBaseline" + $ishObject.Count | Should-Be 1 } It "Parameter IshSession implicit" { $baselineName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " Name") $ishObject = Add-IshBaseline -Name $baselineName $metadata = Set-IshMetadataField -Name "FISHDOCUMENTRELEASE" -Level None -Value "$baselineName RENAMED" $ishObject = Set-IshBaseline -Id $ishObject.IshRef -Metadata $metadata - $ishObject.GetType().Name | Should -BeExactly "IshBaseline" - $ishObject.Count | Should -Be 1 - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" - $ishObject.fishdocumentrelease.Length -ge 1 | Should -Be $true - $ishObject.fishdocumentrelease_none_element.StartsWith('GUID') | Should -Be $true + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshBaseline" + $ishObject.Count | Should-Be 1 + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" + $ishObject.fishdocumentrelease.Length -ge 1 | Should-Be $true + $ishObject.fishdocumentrelease_none_element.StartsWith('GUID') | Should-Be $true } } @@ -50,29 +50,29 @@ Describe "Set-IshBaseline" -Tags "Create" { $ishObjectF = Add-IshBaseline -IshSession $ishSession -Name $baselineName } It "Parameter IshObject invalid" { - { Set-IshBaseline -IShSession $ishSession -IshObject "INVALIDBASELINE" } | Should -Throw + { Set-IshBaseline -IShSession $ishSession -IshObject "INVALIDBASELINE" } | Should-Throw } It "Parameter IshObject Single" { $ishObjectA = $ishObjectA | Set-IshMetadataField -IshSession $ishSession -Name "FISHDOCUMENTRELEASE" -Level None -Value ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " A Parameter IshObject Single RENAMED") $ishObjects = Set-IshBaseline -IshSession $ishSession -IshObject $ishObjectA - $ishObjects.Count | Should -Be 1 + $ishObjects.Count | Should-Be 1 } It "Parameter IshObject Multiple" { $ishObjectB = $ishObjectB | Set-IshMetadataField -IshSession $ishSession -Name "FISHDOCUMENTRELEASE" -Level None -Value ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " B Parameter IshObject Multiple RENAMED") $ishObjectC = $ishObjectC | Set-IshMetadataField -IshSession $ishSession -Name "FISHDOCUMENTRELEASE" -Level None -Value ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " C Parameter IshObject Multiple RENAMED") $ishObjects = Set-IshBaseline -IshSession $ishSession -IshObject @($ishObjectB,$ishObjectC) - $ishObjects.Count | Should -Be 2 + $ishObjects.Count | Should-Be 2 } It "Pipeline IshObject Single" { $ishObjectD = $ishObjectD | Set-IshMetadataField -IshSession $ishSession -Name "FISHDOCUMENTRELEASE" -Level None -Value ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " D Pipeline IshObject Single RENAMED") $ishObjects = $ishObjectD | Set-IshBaseline -IshSession $ishSession - $ishObjects.Count | Should -Be 1 + $ishObjects.Count | Should-Be 1 } It "Pipeline IshObject Multiple" { $ishObjectE = $ishObjectE | Set-IshMetadataField -IshSession $ishSession -Name "FISHDOCUMENTRELEASE" -Level None -Value ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " E Pipeline IshObject Multiple RENAMED") $ishObjectF = $ishObjectF | Set-IshMetadataField -IshSession $ishSession -Name "FISHDOCUMENTRELEASE" -Level None -Value ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " F Pipeline IshObject Multiple RENAMED") $ishObjects = @($ishObjectE,$ishObjectF) | Set-IshBaseline -IshSession $ishSession - $ishObjects.Count | Should -Be 2 + $ishObjects.Count | Should-Be 2 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/SetIshBaselineItem.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/SetIshBaselineItem.Tests.ps1 index 4ddbfed..f3ad2a2 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/SetIshBaselineItem.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/SetIshBaselineItem.Tests.ps1 @@ -9,7 +9,7 @@ BeforeAll { Describe "Set-IshBaselineItem" { Context "Set-IshBaselineItem ParameterGroup" { It "Parameter IshSession invalid" { - { Set-IshBaselineItem -IShSession "INVALIDISHSESSION" } | Should -Throw + { Set-IshBaselineItem -IShSession "INVALIDISHSESSION" } | Should-Throw } } Context "Set-IshBaselineItem returns IshObject" { @@ -21,22 +21,22 @@ Describe "Set-IshBaselineItem" { $ishObject = Set-IshBaselineItem -IshObject $ishObject -LogicalId "$cmdletName--AAA" -Version "3" # new } It "GetType()" { - $ishObject.GetType().Name | Should -BeExactly "IshBaseline" + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshBaseline" } It "$ishObject.IshRef" { - $ishObject.IshRef | Should -Not -BeNullOrEmpty + $ishObject.IshRef | Should-NotBeNull } It "3 News" { - (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject).Count | Should -Be 3 + (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject).Count | Should-Be 3 } It "3 News and 1 Update" { Set-IshBaselineItem -IshSession $ishSession -IshObject $ishObject -LogicalId "$cmdletName--A" -Version "4" # update - (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject).Count | Should -Be 3 + (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject).Count | Should-Be 3 } It "3 News and 1 Update and 2 Removes" { Remove-IshBaselineItem -IshSession $ishSession -IshObject $ishObject -LogicalId "$cmdletName--A" # remove Remove-IshBaselineItem -IshSession $ishSession -IshObject $ishObject -LogicalId "$cmdletName--AA" # remove - (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject).Count | Should -Be 1 + (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObject).Count | Should-Be 1 } } Context "Set-IshBaseline IshBaselineItemsGroup" { @@ -52,37 +52,37 @@ Describe "Set-IshBaselineItem" { $ishObjectItemMultiple = Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObjectMultiple } It "Setup IshBaselineItem Test Single GetType()" { - ($ishObjectItemSingle).GetType().Name | Should -BeExactly "IshBaselineItem" + ($ishObjectItemSingle).GetType().Name | Should-BeString -CaseSensitive "IshBaselineItem" } It "Setup IshBaselineItem Test Multiple GetType()" { - ($ishObjectItemMultiple).GetType().Name | Should -BeExactly "Object[]" + ($ishObjectItemMultiple).GetType().Name | Should-BeString -CaseSensitive "Object[]" } It "Parameter IshBaselineItem invalid" { - { Set-IshBaselineItem -IShSession $ishSession -IshBaselineItem "INVALIDBASELINE" } | Should -Throw + { Set-IshBaselineItem -IShSession $ishSession -IshBaselineItem "INVALIDBASELINE" } | Should-Throw } It "Parameter IshBaselineItem Single" { $baselineName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " A") $ishObjectA = Add-IshBaseline -IshSession $ishSession -Name $baselineName $ishObjectA = Set-IshBaselineItem -IshSession $ishSession -IshObject $ishObjectA -IshBaselineItem $ishObjectItemSingle - (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObjectA).Count | Should -Be 1 + (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObjectA).Count | Should-Be 1 } It "Parameter IshBaselineItem Multiple" { $baselineName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " B") $ishObjectB = Add-IshBaseline -IshSession $ishSession -Name $baselineName $ishObjectB = Set-IshBaselineItem -IshSession $ishSession -IshObject $ishObjectB -IshBaselineItem $ishObjectItemMultiple - (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObjectB).Count | Should -Be 2 + (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObjectB).Count | Should-Be 2 } It "Pipeline IshBaselineItem Single" { $baselineName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " C") $ishObjectC = Add-IshBaseline -IshSession $ishSession -Name $baselineName $ishObjectC = $ishObjectItemSingle | Set-IshBaselineItem -IshSession $ishSession -IshObject $ishObjectC - (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObjectC).Count | Should -Be 1 + (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObjectC).Count | Should-Be 1 } It "Pipeline IshBaselineItem Multiple" { $baselineName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " D") $ishObjectD = Add-IshBaseline -IshSession $ishSession -Name $baselineName $ishObjectD = $ishObjectItemMultiple | Set-IshBaselineItem -IshSession $ishSession -IshObject $ishObjectD - (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObjectD).Count | Should -Be 2 + (Get-IshBaselineItem -IshSession $ishSession -IshObject $ishObjectD).Count | Should-Be 2 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/AddIshDocumentObj.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/AddIshDocumentObj.Tests.ps1 index b67fd85..e19a492 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/AddIshDocumentObj.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/AddIshDocumentObj.Tests.ps1 @@ -36,81 +36,81 @@ Describe "Add-IshDocumentObj" -Tags "Create" { $ishObject = Add-IshDocumentObj -IshSession $ishSession -FolderId $ishFolderTopic.IshFolderRef -IshType ISHModule -Lng $ishLng -Metadata $ishTopicMetadata -FileContent $ditaTopicFileContent } It "GetType().Name" { - $ishObject.GetType().Name | Should -BeExactly "IshDocumentObj" + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshDocumentObj" } It "ishObject.IshData" { { $ishObject.IshData } | Should -Not -Throw } It "ishObject.IshField" { - $ishObject.IshField | Should -Not -BeNullOrEmpty + $ishObject.IshField | Should-NotBeNull } It "ishObject.IshRef" { - $ishObject.IshRef | Should -Not -BeNullOrEmpty + $ishObject.IshRef | Should-NotBeNull } It "ishObject.IshType" { - $ishObject.IshType | Should -Not -BeNullOrEmpty + $ishObject.IshType | Should-NotBeNull } # Double check following 3 ReferenceType enum usage It "ishObject.ObjectRef" { - $ishObject.ObjectRef | Should -Not -BeNullOrEmpty + $ishObject.ObjectRef | Should-NotBeNull } It "ishObject.VersionRef" { - $ishObject.VersionRef | Should -Not -BeNullOrEmpty + $ishObject.VersionRef | Should-NotBeNull } It "ishObject.LngRef" { - $ishObject.LngRef | Should -Not -BeNullOrEmpty + $ishObject.LngRef | Should-NotBeNull } It "ishObject ConvertTo-Json" { - (ConvertTo-Json $ishObject).Length -gt 2 | Should -Be $true + (ConvertTo-Json $ishObject).Length -gt 2 | Should-Be $true } It "Option IshSession.DefaultRequestedMetadata" { - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" #logical - $ishObject.ftitle_logical_value.Length -ge 1 | Should -Be $true + $ishObject.ftitle_logical_value.Length -ge 1 | Should-Be $true #version - $ishObject.version_version_value.Length -ge 1 | Should -Be $true + $ishObject.version_version_value.Length -ge 1 | Should-Be $true #language - $ishObject.fstatus.Length -ge 1 | Should -Be $true - $ishObject.fstatus_lng_element.StartsWith('VSTATUS') | Should -Be $true - $ishObject.doclanguage.Length -ge 1 | Should -Be $true # Field names like DOC-LANGUAGE get stripped of the hyphen, otherwise you get $ishObject.'doc-language' and now you get the more readable $ishObject.doclanguage - $ishObject.doclanguage_lng_element.StartsWith('VLANGUAGE') | Should -Be $true + $ishObject.fstatus.Length -ge 1 | Should-Be $true + $ishObject.fstatus_lng_element.StartsWith('VSTATUS') | Should-Be $true + $ishObject.doclanguage.Length -ge 1 | Should-Be $true # Field names like DOC-LANGUAGE get stripped of the hyphen, otherwise you get $ishObject.'doc-language' and now you get the more readable $ishObject.doclanguage + $ishObject.doclanguage_lng_element.StartsWith('VLANGUAGE') | Should-Be $true } } Context "Add-IshDocumentObj ParameterGroupFileContent" { It "Parameter IshSession/Lng/FileContent invalid" { - { Add-IshDocumentObj -IShSession "INVALIDISHSESSION" -Lng "INVALIDLANGUAGE" -FileContent "INVALIDFILECONTENT" } | Should -Throw + { Add-IshDocumentObj -IShSession "INVALIDISHSESSION" -Lng "INVALIDLANGUAGE" -FileContent "INVALIDFILECONTENT" } | Should-Throw } It "Parameter Lng/FileContent invalid" { - { Add-IshDocumentObj -IShSession $ishSession -Lng "INVALIDLANGUAGE" -FileContent "INVALIDFILECONTENT" } | Should -Throw + { Add-IshDocumentObj -IShSession $ishSession -Lng "INVALIDLANGUAGE" -FileContent "INVALIDFILECONTENT" } | Should-Throw } It "Parameter FileContent invalid" { - { Add-IshDocumentObj -IShSession $ishSession -Lng $ishLng -FileContent "INVALIDFILECONTENT" } | Should -Throw + { Add-IshDocumentObj -IShSession $ishSession -Lng $ishLng -FileContent "INVALIDFILECONTENT" } | Should-Throw } It "All Parameters (Topic)" { $ishTopicMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "All Parameters Topic $timestamp" | Set-IshMetadataField -IshSession $ishSession -Name "FAUTHOR" -Level Lng -ValueType Element -Value $ishUserAuthor | Set-IshMetadataField -IshSession $ishSession -Name "FSTATUS" -Level Lng -ValueType Element -Value $ishStatusDraft - $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderTopic -IshType ISHModule -LogicalId "MYOWNGENERATEDLOGICALIDTOPIC" -Version '2' -Lng $ishLng -Metadata $ishTopicMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent - $ishObject.LngRef -gt 0 | Should -Be $true + $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderTopic -IshType ISHModule -LogicalId "ADDISHDOCUMENTOBJ-MYOWNGENERATEDLOGICALIDTOPIC" -Version '2' -Lng $ishLng -Metadata $ishTopicMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent + $ishObject.LngRef -gt 0 | Should-Be $true } It "All Parameters (Map)" { $ishMapMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "All Parameters Map $timestamp" | Set-IshMetadataField -IshSession $ishSession -Name "FAUTHOR" -Level Lng -ValueType Element -Value $ishUserAuthor | Set-IshMetadataField -IshSession $ishSession -Name "FSTATUS" -Level Lng -ValueType Element -Value $ishStatusDraft - $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderMap -IshType ISHMasterDoc -LogicalId "MYOWNGENERATEDLOGICALIDMAP" -Version '3' -Lng $ishLng -Metadata $ishMapMetadata -Edt "EDTXML" -FileContent $ditaMapFileContent - $ishObject.LngRef -gt 0 | Should -Be $true + $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderMap -IshType ISHMasterDoc -LogicalId "ADDISHDOCUMENTOBJ-MYOWNGENERATEDLOGICALIDMAP" -Version '3' -Lng $ishLng -Metadata $ishMapMetadata -Edt "EDTXML" -FileContent $ditaMapFileContent + $ishObject.LngRef -gt 0 | Should-Be $true } It "All Parameters (Lib)" { $ishLibMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "All Parameters Lib $timestamp" | Set-IshMetadataField -IshSession $ishSession -Name "FAUTHOR" -Level Lng -ValueType Element -Value $ishUserAuthor | Set-IshMetadataField -IshSession $ishSession -Name "FSTATUS" -Level Lng -ValueType Element -Value $ishStatusDraft - $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderLib -IshType ISHLibrary -LogicalId "MYOWNGENERATEDLOGICALIDLIB" -Version '4' -Lng $ishLng -Metadata $ishLibMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent - $ishObject.LngRef -gt 0 | Should -Be $true + $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderLib -IshType ISHLibrary -LogicalId "ADDISHDOCUMENTOBJ-MYOWNGENERATEDLOGICALIDLIB" -Version '4' -Lng $ishLng -Metadata $ishLibMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent + $ishObject.LngRef -gt 0 | Should-Be $true } } Context "Add-IshDocumentObj ParameterGroupFilePath" { It "Parameter IshSession/Lng/FilePath invalid" { - { Add-IshDocumentObj -IShSession "INVALIDISHSESSION" -Lng "INVALIDLANGUAGE" -FilePath "INVALIDFILEPATH" } | Should -Throw + { Add-IshDocumentObj -IShSession "INVALIDISHSESSION" -Lng "INVALIDLANGUAGE" -FilePath "INVALIDFILEPATH" } | Should-Throw } It "All Parameters (Image like EDTJPEG)" { $ishImageMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "All Parameters Image $timestamp" | @@ -127,16 +127,16 @@ Describe "Add-IshDocumentObj" -Tags "Create" { } } $bmp.Save($tempFilePath, [System.Drawing.Imaging.ImageFormat]::Jpeg) - $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderImage -IshType ISHIllustration -LogicalId "MYOWNGENERATEDLOGICALIDIMAGE" -Version '5' -Lng $ishLng -Resolution $ishResolution -Metadata $ishImageMetadata -Edt "EDTJPEG" -FilePath $tempFilePath - $ishObject.LngRef -gt 0 | Should -Be $true + $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderImage -IshType ISHIllustration -LogicalId "ADDISHDOCUMENTOBJ-MYOWNGENERATEDLOGICALIDIMAGE" -Version '5' -Lng $ishLng -Resolution $ishResolution -Metadata $ishImageMetadata -Edt "EDTJPEG" -FilePath $tempFilePath + $ishObject.LngRef -gt 0 | Should-Be $true } It "All Parameters (Other like EDT-TEXT)" { $ishOtherMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "All Parameters Other $timestamp" | Set-IshMetadataField -IshSession $ishSession -Name "FAUTHOR" -Level Lng -ValueType Element -Value $ishUserAuthor | Set-IshMetadataField -IshSession $ishSession -Name "FSTATUS" -Level Lng -ValueType Element -Value $ishStatusDraft Get-Process | Out-File $tempFilePath - $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderOther -IshType ISHTemplate -LogicalId "MYOWNGENERATEDLOGICALIDOTHER" -Version '6' -Lng $ishLng -Metadata $ishOtherMetadata -Edt "EDT-TEXT" -FilePath $tempFilePath - $ishObject.LngRef -gt 0 | Should -Be $true + $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderOther -IshType ISHTemplate -LogicalId "ADDISHDOCUMENTOBJ-MYOWNGENERATEDLOGICALIDOTHER" -Version '6' -Lng $ishLng -Metadata $ishOtherMetadata -Edt "EDT-TEXT" -FilePath $tempFilePath + $ishObject.LngRef -gt 0 | Should-Be $true } } Context "Add-IshDocumentObj IshObjectGroup" { @@ -146,7 +146,7 @@ Describe "Add-IshDocumentObj" -Tags "Create" { Set-IshMetadataField -IshSession $ishSession -Name "FSTATUS" -Level Lng -ValueType Element -Value $ishStatusDraft } It "Parameter IshObject invalid" { - { Add-IshDocumentObj -IshSession $ishSession -IshFolder "INVALIDISHFOLDER" -IshObject "INVALIDISHOBJECT" } | Should -Throw + { Add-IshDocumentObj -IshSession $ishSession -IshFolder "INVALIDISHFOLDER" -IshObject "INVALIDISHOBJECT" } | Should-Throw } It "Parameter IshObject Single with implicit IshSession" { # Create an object, Delete it, Recreate it using parameter IshObject as if the incoming object came from another repository @@ -154,7 +154,7 @@ Describe "Add-IshDocumentObj" -Tags "Create" { Get-IshDocumentObjData Remove-IshDocumentObj -IshSession $ishSession -IshObject $ishObject $ishObjectArray = Add-IshDocumentObj -IshFolder $ishFolderTopic -IshObject $ishObject - $ishObjectArray.Count | Should -Be 1 + $ishObjectArray.Count | Should-Be 1 } It "Parameter IshObject Multiple with implicit IshSession" { # Create an object, Delete it, Recreate it using parameter IshObject as if the incoming object came from another repository @@ -165,7 +165,7 @@ Describe "Add-IshDocumentObj" -Tags "Create" { Get-IshDocumentObjData Remove-IshDocumentObj -IshObject $ishObjectB $ishObjectArray = Add-IshDocumentObj -IshFolder $ishFolderTopic -IshObject @($ishObjectA,$ishObjectB) - $ishObjectArray.Count | Should -Be 2 + $ishObjectArray.Count | Should-Be 2 } It "Pipeline IshObject Single" { # Create an object, Delete it, Recreate it using parameter IshObject as if the incoming object came from another repository @@ -173,7 +173,7 @@ Describe "Add-IshDocumentObj" -Tags "Create" { Get-IshDocumentObjData -IshSession $ishSession Remove-IshDocumentObj -IshSession $ishSession -IshObject $ishObjectC $ishObjectArray = $ishObjectC | Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderTopic - $ishObjectArray.Count | Should -Be 1 + $ishObjectArray.Count | Should-Be 1 } It "Pipeline IshObject Multiple" { # Create an object, Delete it, Recreate it using parameter IshObject as if the incoming object came from another repository @@ -184,7 +184,7 @@ Describe "Add-IshDocumentObj" -Tags "Create" { $ishObjects = @($ishObjectD,$ishObjectE) $ishObjects | Remove-IshDocumentObj -IshSession $ishSession $ishObjectArray = $ishObjects | Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderTopic - $ishObjects.Count -eq $ishObjectArray.Count | Should -Be $true + $ishObjects.Count -eq $ishObjectArray.Count | Should-Be $true } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/GetIshDocumentObjData.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/GetIshDocumentObjData.Tests.ps1 index 4a834e8..59ce50e 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/GetIshDocumentObjData.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/GetIshDocumentObjData.Tests.ps1 @@ -37,12 +37,12 @@ Describe "Get-IshDocumentObjData" -Tags "Read" { } Context "Get-IshDocumentObjData FolderPathGroup" { It "Parameter IshSession/IshObject invalid" { - { Get-IshDocumentObjData -IShSession "INVALIDISHSESSION" -IshObject "INVALIDISHOBJECT" } | Should -Throw + { Get-IshDocumentObjData -IShSession "INVALIDISHSESSION" -IshObject "INVALIDISHOBJECT" } | Should-Throw } It "FileInfo.Name contains 4 = signs" { $fileInfo = Get-IshDocumentObjData -IshSession $ishSession -IshObject $ishObjectTopicA -FolderPath (Join-Path $tempFolder $cmdletName) - $fileInfo.GetType().Name | Should -BeExactly "FileInfo" - $fileInfo.Name -like "*=*=*=*=*.*" | Should -Be $true + $fileInfo.GetType().Name | Should-BeString -CaseSensitive "FileInfo" + $fileInfo.Name -like "*=*=*=*=*.*" | Should-Be $true } It "Parameter IshFeature matching features (so everything equals source file)" { $ishFeatures = Set-IshFeature -Name "ISHRemoteStringCond" -Value "StringOne" | @@ -50,40 +50,40 @@ Describe "Get-IshDocumentObjData" -Tags "Read" { $fileInfo = Get-IshDocumentObjData -IshSession $ishSession -IshObject $ishObjectTopicA -FolderPath (Join-Path $tempFolder $cmdletName) -IshFeature $ishFeatures $fileContent = Get-Content $fileInfo -Raw Write-Debug ("fileContent.Length[" + $fileContent.Length + "] fileContent.GetType()[" + $fileContent.GetType() + "] fileContent[" +$fileContent+"]") - ($fileContent -like "*ISHRemoteStringCond*") | Should -Be $true + ($fileContent -like "*ISHRemoteStringCond*") | Should-Be $true } It "Parameter IshFeature not matching features (so everything filtered away)" { $ishFeatures = Set-IshFeature -Name "INVALIDFEATURE" -Value "INVALIDVALUE" $fileInfo = Get-IshDocumentObjData -IshSession $ishSession -IshObject $ishObjectTopicA -FolderPath (Join-Path $tempFolder $cmdletName) -IshFeature $ishFeatures $fileContent = Get-Content $fileInfo -Raw Write-Debug ("fileContent.Length[" + $fileContent.Length + "] fileContent.GetType()[" + $fileContent.GetType() + "] fileContent[" +$fileContent+"]") - $fileContent -notlike "*ISHRemoteStringCond*" | Should -Be $true + $fileContent -notlike "*ISHRemoteStringCond*" | Should-Be $true } It "FolderPath with long FTITLE returns FileInfo without PathTooLongException" { $fileInfo = Get-IshDocumentObjData -IshSession $ishSession -IshObject $ishObjectLongTitleTopic -FolderPath (Join-Path $tempFolder $cmdletName) - $fileInfo.GetType().Name | Should -BeExactly "FileInfo" + $fileInfo.GetType().Name | Should-BeString -CaseSensitive "FileInfo" } } Context "Get-IshDocumentObjData IshObjectGroup" { It "GetType().Name" { $ishobjects = Get-IshDocumentObjData -IshSession $ishSession -IshObject @($ishObjectTopicA,$ishObjectLibraryA) - $ishobjects.GetType().Name | Should -BeExactly "Object[]" + $ishobjects.GetType().Name | Should-BeString -CaseSensitive "Object[]" } It "Parameter IshObject Single with implicit IshSession" { $ishobjects = Get-IshDocumentObjData -IshObject $ishObjectTopicA - $ishobjects.Count | Should -Be 1 + $ishobjects.Count | Should-Be 1 } It "Parameter IshObject Multiple with implicit IshSession" { $ishobjects = Get-IshDocumentObjData -IshObject @($ishObjectTopicA,$ishObjectLibraryA) - $ishobjects.Count | Should -Be 2 + $ishobjects.Count | Should-Be 2 } It "Pipeline IshObject Single" { $ishobjects = $ishObjectTopicA | Get-IshDocumentObjData -IshSession $ishSession - $ishobjects.Count | Should -Be 1 + $ishobjects.Count | Should-Be 1 } It "Pipeline IshObject Multiple" { $ishobjects = @($ishObjectTopicA,$ishObjectLibraryA) | Get-IshDocumentObjData -IshSession $ishSession - $ishobjects.Count | Should -Be 2 + $ishobjects.Count | Should-Be 2 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/GetIshDocumentObjFolderLocation.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/GetIshDocumentObjFolderLocation.Tests.ps1 index 7ab0e65..6761f1b 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/GetIshDocumentObjFolderLocation.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/GetIshDocumentObjFolderLocation.Tests.ps1 @@ -34,38 +34,38 @@ Describe "Get-IshDocumentObjFolderLocation" -Tags "Read" { $folderPath = Get-IShDocumentObjFolderLocation -IshSession $ishSession -LogicalId $ishObjectTopicA.IshRef } It "Parameter IshSession/LogicalId invalid" { - { Get-IshDocumentObjFolderLocation -IShSession "INVALIDISHSESSION" -LogicalId "INVALIDLOGICALID" } | Should -Throw + { Get-IshDocumentObjFolderLocation -IShSession "INVALIDISHSESSION" -LogicalId "INVALIDLOGICALID" } | Should-Throw } It "GetType().Name" { - $folderPath.GetType().Name | Should -BeExactly "String" + $folderPath.GetType().Name | Should-BeString -CaseSensitive "String" } It "Parameter LogicalId Single" { - $folderPath | Should -BeExactly (Join-Path (Join-Path $folderTestRootPath $cmdletName) "Topic") + $folderPath | Should-BeString -CaseSensitive (Join-Path (Join-Path $folderTestRootPath $cmdletName) "Topic") } It "Leading IshSession.FolderPathSeparator" { - $folderPath[0] | Should -Be $ishSession.FolderPathSeparator + $folderPath[0] | Should-Be $ishSession.FolderPathSeparator } } Context "Get-IshDocumentObjFolderLocation IshObjectGroup" { It "GetType().Name" { $folderPathArray = Get-IShDocumentObjFolderLocation -IshSession $ishSession -IshObject @($ishObjectTopicA,$ishObjectLibraryA) - $folderPathArray.GetType().Name | Should -BeExactly "Object[]" + $folderPathArray.GetType().Name | Should-BeString -CaseSensitive "Object[]" } It "Parameter IshObject Single with implicit IshSession" { $folderPathArray = Get-IShDocumentObjFolderLocation -IshObject $ishObjectTopicA - $folderPathArray.Count | Should -Be 1 + $folderPathArray.Count | Should-Be 1 } It "Parameter IshObject Multiple with implicit IshSession" { $folderPathArray = Get-IShDocumentObjFolderLocation -IshObject @($ishObjectTopicA,$ishObjectLibraryA) - $folderPathArray.Count | Should -Be 2 + $folderPathArray.Count | Should-Be 2 } It "Pipeline IshObject Single" { $folderPathArray = $ishObjectTopicA | Get-IShDocumentObjFolderLocation -IshSession $ishSession - $folderPathArray.Count | Should -Be 1 + $folderPathArray.Count | Should-Be 1 } It "Pipeline IshObject Multiple" { $folderPathArray = @($ishObjectTopicA,$ishObjectLibraryA) | Get-IShDocumentObjFolderLocation -IshSession $ishSession - $folderPathArray.Count | Should -Be 2 + $folderPathArray.Count | Should-Be 2 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/RemoveIshDocumentObj.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/RemoveIshDocumentObj.Tests.ps1 index 2feba2d..cb90c3a 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/RemoveIshDocumentObj.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/RemoveIshDocumentObj.Tests.ps1 @@ -1,4 +1,4 @@ -BeforeAll { +BeforeAll { $cmdletName = "Remove-IshDocumentObj" Write-Host ("`r`nLoading ISHRemote.PesterSetup.ps1 on PSVersion[" + $psversionTable.PSVersion + "] over BeforeAll-block for MyCommand[" + $cmdletName + "]...") . (Join-Path (Split-Path -Parent $PSCommandPath) "\..\..\ISHRemote.PesterSetup.ps1") @@ -44,15 +44,15 @@ Describe "Remove-IshDocumentObj" -Tags "Delete" { Context "Remove-IshDocumentObj check exceptions" { It "LogicalId does not exist. Force=Yes" { - {Remove-IshDocumentObj -IshSession $ishSession -LogicalId "NON-EXISTING-LOGICAL-ID" -Version "1" -Lng $ishLngLabel -Force} | Should -Throw + {Remove-IshDocumentObj -IshSession $ishSession -LogicalId "NON-EXISTING-LOGICAL-ID" -Version "1" -Lng $ishLngLabel -Force} | Should-Throw } It "LogicalId does not exist" { - {Remove-IshDocumentObj -IshSession $ishSession -LogicalId "NON-EXISTING-LOGICAL-ID" -Version "1" -Lng $ishLngLabel} | Should -Throw + {Remove-IshDocumentObj -IshSession $ishSession -LogicalId "NON-EXISTING-LOGICAL-ID" -Version "1" -Lng $ishLngLabel} | Should-Throw } It "Providing both Parameters and ISHObject" { $ishTopicMetadata = $ishObjectMetadata | Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "$($____Pester.CurrentTest.Name) $timestamp" $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderTopic -IshType ISHModule -Version '1' -Lng $ishLng -Metadata $ishTopicMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent - {Remove-IshDocumentObj -IshSession $ishSession -IshObject $ishObject -LogicalId $ishObject.IshRef -Version $ishObject.version_version_value -Lng $ishObject.doclanguage} | Should -Throw + {Remove-IshDocumentObj -IshSession $ishSession -IshObject $ishObject -LogicalId $ishObject.IshRef -Version $ishObject.version_version_value -Lng $ishObject.doclanguage} | Should-Throw } } @@ -62,22 +62,22 @@ Describe "Remove-IshDocumentObj" -Tags "Delete" { $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderTopic -IshType ISHModule -Version '1' -Lng $ishLng -Metadata $ishTopicMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent Remove-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject.IshRef -Version $ishObject.version_version_value -Lng $ishObject.doclanguage -Force $ishObjectRetrieved = Get-IshDocumentObj -IshSession $ishSession -IshObject $ishObject - $ishObjectRetrieved.length -eq 0 | Should -Be $true + $ishObjectRetrieved.length -eq 0 | Should-Be $true } It "Parameters (Map). Force=Yes" { $ishMapMetadata = $ishObjectMetadata | Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "$($____Pester.CurrentTest.Name) $timestamp" - $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderMap -IshType ISHMasterDoc -LogicalId "MYOWNGENERATEDLOGICALIDMAP" -Version '3' -Lng $ishLng -Metadata $ishMapMetadata -Edt "EDTXML" -FileContent $ditaMapFileContent + $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderMap -IshType ISHMasterDoc -LogicalId "REMOVEISHDOCUMENTOBJ-MYOWNGENERATEDLOGICALIDMAP" -Version '3' -Lng $ishLng -Metadata $ishMapMetadata -Edt "EDTXML" -FileContent $ditaMapFileContent Remove-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject.IshRef -Version $ishObject.version_version_value -Lng $ishObject.doclanguage -Force $ishObjectRetrieved = Get-IshDocumentObj -IshSession $ishSession -IshObject $ishObject - $ishObjectRetrieved.length -eq 0 | Should -Be $true + $ishObjectRetrieved.length -eq 0 | Should-Be $true } It "Parameters (Lib). Force=Yes" { $ishLibMetadata = $ishObjectMetadata | Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "$($____Pester.CurrentTest.Name) $timestamp" - $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderLib -IshType ISHLibrary -LogicalId "MYOWNGENERATEDLOGICALIDLIB" -Version '4' -Lng $ishLng -Metadata $ishLibMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent - $ishObject.LngRef -gt 0 | Should -Be $true + $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderLib -IshType ISHLibrary -LogicalId "REMOVEISHDOCUMENTOBJ-MYOWNGENERATEDLOGICALIDLIB" -Version '4' -Lng $ishLng -Metadata $ishLibMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent + $ishObject.LngRef -gt 0 | Should-Be $true Remove-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject.IshRef -Version $ishObject.version_version_value -Lng $ishObject.doclanguage -Force $ishObjectRetrieved = Get-IshDocumentObj -IshSession $ishSession -IshObject $ishObject - $ishObjectRetrieved.length -eq 0 | Should -Be $true + $ishObjectRetrieved.length -eq 0 | Should-Be $true } It "Parameters (Topic) with multiple versions" { @@ -87,9 +87,9 @@ Describe "Remove-IshDocumentObj" -Tags "Delete" { $ishObject3 = Add-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject1.IshRef -IshType ISHModule -Version '3' -Lng $ishLng -Metadata $ishTopicMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent Remove-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject1.IshRef -Version $ishObject1.version_version_value -Lng $ishObject1.doclanguage $ishObjectsRetrieved = Get-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject1.IshRef - $ishObjectsRetrieved.length -eq 2 | Should -Be $true - $ishObjectsRetrieved[0].version_version_value -eq 2 | Should -Be $true - $ishObjectsRetrieved[1].version_version_value -eq 3 | Should -Be $true + $ishObjectsRetrieved.length -eq 2 | Should-Be $true + $ishObjectsRetrieved[0].version_version_value -eq 2 | Should-Be $true + $ishObjectsRetrieved[1].version_version_value -eq 3 | Should-Be $true } It "Parameters (Topic) with multiple versions. Force=Yes" { @@ -99,9 +99,9 @@ Describe "Remove-IshDocumentObj" -Tags "Delete" { $ishObject3 = Add-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject1.IshRef -IshType ISHModule -Version '3' -Lng $ishLng -Metadata $ishTopicMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent Remove-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject1.IshRef -Version $ishObject1.version_version_value -Lng $ishObject1.doclanguage -Force $ishObjectsRetrieved = Get-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject1.IshRef - $ishObjectsRetrieved.length -eq 2 | Should -Be $true - $ishObjectsRetrieved[0].version_version_value -eq 2 | Should -Be $true - $ishObjectsRetrieved[1].version_version_value -eq 3 | Should -Be $true + $ishObjectsRetrieved.length -eq 2 | Should-Be $true + $ishObjectsRetrieved[0].version_version_value -eq 2 | Should-Be $true + $ishObjectsRetrieved[1].version_version_value -eq 3 | Should-Be $true } It "Parameters (Topic) with multiple versions and languages" { @@ -113,11 +113,11 @@ Describe "Remove-IshDocumentObj" -Tags "Delete" { $ishObject3 = Add-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject1.IshRef -IshType ISHModule -Version '2' -Lng $ishLngTarget2Label -Metadata $ishTopicMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent Remove-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject3.IshRef -Version $ishObject3.version_version_value -Lng $ishObject3.doclanguage $ishObjectsRetrieved = Get-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject1.IshRef - $ishObjectsRetrieved.length -eq 2 | Should -Be $true - $ishObjectsRetrieved[0].doclanguage -eq $ishLngLabel | Should -Be $true - $ishObjectsRetrieved[0].version_version_value -eq 1 | Should -Be $true - $ishObjectsRetrieved[1].doclanguage -eq $ishLngLabel | Should -Be $true - $ishObjectsRetrieved[1].version_version_value -eq 2 | Should -Be $true + $ishObjectsRetrieved.length -eq 2 | Should-Be $true + $ishObjectsRetrieved[0].doclanguage -eq $ishLngLabel | Should-Be $true + $ishObjectsRetrieved[0].version_version_value -eq 1 | Should-Be $true + $ishObjectsRetrieved[1].doclanguage -eq $ishLngLabel | Should-Be $true + $ishObjectsRetrieved[1].version_version_value -eq 2 | Should-Be $true } It "Parameters (Topic) with multiple versions and languages. Force=Yes" { @@ -129,11 +129,11 @@ Describe "Remove-IshDocumentObj" -Tags "Delete" { $ishObject3 = Add-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject1.IshRef -IshType ISHModule -Version '2' -Lng $ishLngTarget2Label -Metadata $ishTopicMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent Remove-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject3.IshRef -Version $ishObject3.version_version_value -Lng $ishObject3.doclanguage -Force $ishObjectsRetrieved = Get-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject1.IshRef - $ishObjectsRetrieved.length -eq 2 | Should -Be $true - $ishObjectsRetrieved[0].doclanguage -eq $ishLngLabel | Should -Be $true - $ishObjectsRetrieved[0].version_version_value -eq 1 | Should -Be $true - $ishObjectsRetrieved[1].doclanguage -eq $ishLngLabel | Should -Be $true - $ishObjectsRetrieved[1].version_version_value -eq 2 | Should -Be $true + $ishObjectsRetrieved.length -eq 2 | Should-Be $true + $ishObjectsRetrieved[0].doclanguage -eq $ishLngLabel | Should-Be $true + $ishObjectsRetrieved[0].version_version_value -eq 1 | Should-Be $true + $ishObjectsRetrieved[1].doclanguage -eq $ishLngLabel | Should-Be $true + $ishObjectsRetrieved[1].version_version_value -eq 2 | Should-Be $true } It "Parameters (Image). Force=Yes" { @@ -141,7 +141,7 @@ Describe "Remove-IshDocumentObj" -Tags "Delete" { $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderImage -IshType ISHIllustration -Version '1' -Lng $ishLng -Resolution $ishResolution -Metadata $ishImageMetadata -Edt "EDTJPEG" -FilePath $imageFilePath Remove-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject.IshRef -Version $ishObject.version_version_value -Lng $ishObject.doclanguage -Resolution $ishObject.fresolution -Force $ishObjectRetrieved = Get-IshDocumentObj -IshSession $ishSession -IshObject $ishObject - $ishObjectRetrieved.length -eq 0 | Should -Be $true + $ishObjectRetrieved.length -eq 0 | Should-Be $true } } @@ -151,14 +151,14 @@ Describe "Remove-IshDocumentObj" -Tags "Delete" { $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderTopic -IshType ISHModule -Version '1' -Lng $ishLng -Metadata $ishTopicMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent $ishObject | Remove-IshDocumentObj -IshSession $ishSession -Force $ishObjectRetrieved = Get-IshDocumentObj -IshSession $ishSession -IshObject $ishObject - $ishObjectRetrieved.length -eq 0 | Should -Be $true + $ishObjectRetrieved.length -eq 0 | Should-Be $true } It "IshObject passed via parameter (Topic). Force=Yes" { $ishTopicMetadata = $ishObjectMetadata | Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "$($____Pester.CurrentTest.Name) $timestamp" $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderTopic -IshType ISHModule -Version '1' -Lng $ishLng -Metadata $ishTopicMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent Remove-IshDocumentObj -IshSession $ishSession -IshObject $ishObject -Force $ishObjectRetrieved = Get-IshDocumentObj -IshSession $ishSession -IshObject $ishObject - $ishObjectRetrieved.length -eq 0 | Should -Be $true + $ishObjectRetrieved.length -eq 0 | Should-Be $true } It "IshObject passed via pipeline (Topic) multiple versions" { @@ -168,9 +168,9 @@ Describe "Remove-IshDocumentObj" -Tags "Delete" { $ishObject3 = Add-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject1.IshRef -IshType ISHModule -Version '3' -Lng $ishLng -Metadata $ishTopicMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent $ishObject1 | Remove-IshDocumentObj -IshSession $ishSession $ishObjectsRetrieved = Get-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject1.IshRef - $ishObjectsRetrieved.length -eq 2 | Should -Be $true - $ishObjectsRetrieved[0].version_version_value -eq 2 | Should -Be $true - $ishObjectsRetrieved[1].version_version_value -eq 3 | Should -Be $true + $ishObjectsRetrieved.length -eq 2 | Should-Be $true + $ishObjectsRetrieved[0].version_version_value -eq 2 | Should-Be $true + $ishObjectsRetrieved[1].version_version_value -eq 3 | Should-Be $true } It "IshObject passed via pipeline (Topic) multiple versions. Force=Yes" { @@ -180,9 +180,9 @@ Describe "Remove-IshDocumentObj" -Tags "Delete" { $ishObject3 = Add-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject1.IshRef -IshType ISHModule -Version '3' -Lng $ishLng -Metadata $ishTopicMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent $ishObject1 | Remove-IshDocumentObj -IshSession $ishSession -Force $ishObjectsRetrieved = Get-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject1.IshRef - $ishObjectsRetrieved.length -eq 2 | Should -Be $true - $ishObjectsRetrieved[0].version_version_value -eq 2 | Should -Be $true - $ishObjectsRetrieved[1].version_version_value -eq 3 | Should -Be $true + $ishObjectsRetrieved.length -eq 2 | Should-Be $true + $ishObjectsRetrieved[0].version_version_value -eq 2 | Should-Be $true + $ishObjectsRetrieved[1].version_version_value -eq 3 | Should-Be $true } It "Multiple IshObjects of the same LogicalId passed via pipeline. Force=Yes" { @@ -192,7 +192,7 @@ Describe "Remove-IshDocumentObj" -Tags "Delete" { $ishObject3 = Add-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject1.IshRef -IshType ISHModule -Version '3' -Lng $ishLng -Metadata $ishTopicMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent Get-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject1.IshRef | Remove-IshDocumentObj -IshSession $ishSession -Force $ishObjectsRetrieved = Get-IshDocumentObj -IshSession $ishSession -LogicalId $ishObject1.IshRef - $ishObjectsRetrieved.length -eq 0 | Should -Be $true + $ishObjectsRetrieved.length -eq 0 | Should-Be $true } It "Multiple IshObjects of different LogicalId passed via pipeline. Force=Yes" { @@ -202,7 +202,7 @@ Describe "Remove-IshDocumentObj" -Tags "Delete" { $ishObject3 = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderTopic -IshType ISHModule -Version '1' -Lng $ishLng -Metadata $ishTopicMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent @($ishObject1,$ishObject2,$ishObject3) | Get-IshDocumentObj -IshSession $ishSession | Remove-IshDocumentObj -IshSession $ishSession -Force $ishObjectsRetrieved = @($ishObject1,$ishObject2,$ishObject3) | Get-IshDocumentObj -IshSession $ishSession - $ishObjectsRetrieved.length -eq 0 | Should -Be $true + $ishObjectsRetrieved.length -eq 0 | Should-Be $true } It "IshObject passed via pipeline (Image). Force=Yes" { @@ -210,7 +210,7 @@ Describe "Remove-IshDocumentObj" -Tags "Delete" { $ishObject = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderImage -IshType ISHIllustration -Version '1' -Lng $ishLng -Resolution $ishResolution -Metadata $ishImageMetadata -Edt "EDTJPEG" -FilePath $imageFilePath $ishObject | Remove-IshDocumentObj -IshSession $ishSession -Force $ishObjectRetrieved = Get-IshDocumentObj -IshSession $ishSession -IshObject $ishObject - $ishObjectRetrieved.length -eq 0 | Should -Be $true + $ishObjectRetrieved.length -eq 0 | Should-Be $true } It "Multiple IshObjects passed via pipeline (Image and Topic). Force=Yes" { @@ -220,7 +220,7 @@ Describe "Remove-IshDocumentObj" -Tags "Delete" { $ishObjectTopic = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderTopic -IshType ISHModule -Version '1' -Lng $ishLng -Metadata $ishTopicMetadata -Edt "EDTXML" -FileContent $ditaTopicFileContent @($ishObjectTopic, $ishObjectImage) | Remove-IshDocumentObj -IshSession $ishSession -Force $ishObjectRetrieved = @($ishObjectTopic, $ishObjectImage) | Get-IshDocumentObj -IshSession $ishSession - $ishObjectRetrieved.length -eq 0 | Should -Be $true + $ishObjectRetrieved.length -eq 0 | Should-Be $true } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/SearchIshDocumentObj.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/SearchIshDocumentObj.Tests.ps1 index 2b48ebb..38da76d 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/SearchIshDocumentObj.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/SearchIshDocumentObj.Tests.ps1 @@ -29,44 +29,44 @@ Describe "Search-IshDocumentObjData" -Tags "Read" { } Context "Search-IshDocumentObj SimpleQueryGroup" { It "Parameter IshSession invalid" { - { Search-IshDocumentObj -IShSession "INVALIDISHSESSION" -SimpleQuery "INVALIDQUERY IS NOT INVALID IT IS JUST A QUERY" } | Should -Throw + { Search-IshDocumentObj -IShSession "INVALIDISHSESSION" -SimpleQuery "INVALIDQUERY IS NOT INVALID IT IS JUST A QUERY" } | Should-Throw } It "Parameter MaxHitsToReturn invalid" { - { Search-IshDocumentObj -MaxHitsToReturn "INVALIDMAXHITSTORETURN" -SimpleQuery "INVALIDQUERY IS NOT INVALID IT IS JUST A QUERY" } | Should -Throw - { Search-IshDocumentObj -MaxHitsToReturn -3 -SimpleQuery "INVALIDQUERY IS NOT INVALID IT IS JUST A QUERY" } | Should -Throw + { Search-IshDocumentObj -MaxHitsToReturn "INVALIDMAXHITSTORETURN" -SimpleQuery "INVALIDQUERY IS NOT INVALID IT IS JUST A QUERY" } | Should-Throw + { Search-IshDocumentObj -MaxHitsToReturn -3 -SimpleQuery "INVALIDQUERY IS NOT INVALID IT IS JUST A QUERY" } | Should-Throw } It "Parameter MaxHitsToReturn" { $ishObject = Search-IshDocumentObj -MaxHitsToReturn 3 -SimpleQuery "*" - $ishObject.Count -eq 3 | Should -Be $true + $ishObject.Count -eq 3 | Should-Be $true } It "Parameter RequestedMetadata" { $requestedMetadata = Set-IshRequestedMetadataField -Level Lng -Name FISHSTATUSTYPE $ishObject = Search-IshDocumentObj -IShSession $ishSession -MaxHitsToReturn 2 -SimpleQuery "*" -RequestedMetadata $requestedMetadata - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" #logical - $ishObject[0].ftitle_logical_value.Length -ge 1 | Should -Be $true + $ishObject[0].ftitle_logical_value.Length -ge 1 | Should-Be $true #version - $ishObject[0].version_version_value.Length -ge 1 | Should -Be $true + $ishObject[0].version_version_value.Length -ge 1 | Should-Be $true #language - $ishObject[0].fstatus.Length -ge 1 | Should -Be $true - $ishObject[0].fstatus_lng_element.StartsWith('VSTATUS') | Should -Be $true - $ishObject[0].doclanguage.Length -ge 1 | Should -Be $true # Field names like DOC-LANGUAGE get stripped of the hyphen, otherwise you get $ishObject.'doc-language' and now you get the more readable $ishObject.doclanguage - $ishObject[0].doclanguage_lng_element.StartsWith('VLANGUAGE') | Should -Be $true - $ishObject[0].fishstatustype -ge 0 | Should -Be $true # Basic does not return FISHSTATUSTYPE but extra RequestedMetadata parameter does + $ishObject[0].fstatus.Length -ge 1 | Should-Be $true + $ishObject[0].fstatus_lng_element.StartsWith('VSTATUS') | Should-Be $true + $ishObject[0].doclanguage.Length -ge 1 | Should-Be $true # Field names like DOC-LANGUAGE get stripped of the hyphen, otherwise you get $ishObject.'doc-language' and now you get the more readable $ishObject.doclanguage + $ishObject[0].doclanguage_lng_element.StartsWith('VLANGUAGE') | Should-Be $true + $ishObject[0].fishstatustype -ge 0 | Should-Be $true # Basic does not return FISHSTATUSTYPE but extra RequestedMetadata parameter does } It "Parameter Count" { $count = Search-IshDocumentObj -SimpleQuery "*" -Count - $count -ge 0 | Should -Be $true + $count -ge 0 | Should-Be $true } It "Search-IshDocumentObj returns IshObject objects" { $ishObject = Search-IshDocumentObj -IShSession $ishSession -MaxHitsToReturn 2 -SimpleQuery "*" - $ishObject[0].IshField | Should -Not -BeNullOrEmpty - $ishObject[0].IshRef | Should -Not -BeNullOrEmpty - $ishObject[0].IshType | Should -Not -BeNullOrEmpty - $ishObject[0].ObjectRef | Should -Not -BeNullOrEmpty - $ishObject[0].VersionRef | Should -Not -BeNullOrEmpty - $ishObject[0].LngRef | Should -Not -BeNullOrEmpty - $ishObject[0].fishstatustype -ge 0 | Should -Be $false # Basic does not return FISHSTATUSTYPE but extra RequestedMetadata parameter does + $ishObject[0].IshField | Should-NotBeNull + $ishObject[0].IshRef | Should-NotBeNull + $ishObject[0].IshType | Should-NotBeNull + $ishObject[0].ObjectRef | Should-NotBeNull + $ishObject[0].VersionRef | Should-NotBeNull + $ishObject[0].LngRef | Should-NotBeNull + $ishObject[0].fishstatustype -ge 0 | Should-Be $false # Basic does not return FISHSTATUSTYPE but extra RequestedMetadata parameter does } } Context "Search-IshDocumentObj XmlQueryQueryGroup" { @@ -111,47 +111,47 @@ Describe "Search-IshDocumentObjData" -Tags "Read" { $xmlQueryAllVersions = $xmlQueryAllVersions -replace "#!#ISHRemoteParameter:UserLanguage#!#", $ishSession.UserLanguage } It "Parameter IshSession invalid" { - { Search-IshDocumentObj -IShSession "INVALIDISHSESSION" -XmlQuery "INVALIDQUERY" } | Should -Throw + { Search-IshDocumentObj -IShSession "INVALIDISHSESSION" -XmlQuery "INVALIDQUERY" } | Should-Throw } It "Parameter XmlQuery invalid" { - { Search-IshDocumentObj -IShSession $ishSession -XmlQuery "INVALIDQUERY" } | Should -Throw + { Search-IshDocumentObj -IShSession $ishSession -XmlQuery "INVALIDQUERY" } | Should-Throw } It "Parameter MaxHitsToReturn invalid" { - { Search-IshDocumentObj -MaxHitsToReturn "INVALIDMAXHITSTORETURN" -XmlQuery $xmlQueryLatestVersion } | Should -Throw - { Search-IshDocumentObj -MaxHitsToReturn -4 -XmlQuery $xmlQueryLatestVersion } | Should -Throw + { Search-IshDocumentObj -MaxHitsToReturn "INVALIDMAXHITSTORETURN" -XmlQuery $xmlQueryLatestVersion } | Should-Throw + { Search-IshDocumentObj -MaxHitsToReturn -4 -XmlQuery $xmlQueryLatestVersion } | Should-Throw } It "Parameter MaxHitsToReturn" { $ishObject = Search-IshDocumentObj -MaxHitsToReturn 4 -XmlQuery $xmlQueryLatestVersion - $ishObject.Count -eq 4 | Should -Be $true + $ishObject.Count -eq 4 | Should-Be $true } It "Parameter RequestedMetadata" { $requestedMetadata = Set-IshRequestedMetadataField -Level Lng -Name FISHSTATUSTYPE $ishObject = Search-IshDocumentObj -IShSession $ishSession -MaxHitsToReturn 2 -XmlQuery $xmlQueryLatestVersion -RequestedMetadata $requestedMetadata - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" #logical - $ishObject[0].ftitle_logical_value.Length -ge 1 | Should -Be $true + $ishObject[0].ftitle_logical_value.Length -ge 1 | Should-Be $true #version - $ishObject[0].version_version_value.Length -ge 1 | Should -Be $true + $ishObject[0].version_version_value.Length -ge 1 | Should-Be $true #language - $ishObject[0].fstatus.Length -ge 1 | Should -Be $true - $ishObject[0].fstatus_lng_element.StartsWith('VSTATUS') | Should -Be $true - $ishObject[0].doclanguage.Length -ge 1 | Should -Be $true # Field names like DOC-LANGUAGE get stripped of the hyphen, otherwise you get $ishObject.'doc-language' and now you get the more readable $ishObject.doclanguage - $ishObject[0].doclanguage_lng_element.StartsWith('VLANGUAGE') | Should -Be $true - $ishObject[0].fishstatustype -ge 0 | Should -Be $true # Basic does not return FISHSTATUSTYPE but extra RequestedMetadata parameter does + $ishObject[0].fstatus.Length -ge 1 | Should-Be $true + $ishObject[0].fstatus_lng_element.StartsWith('VSTATUS') | Should-Be $true + $ishObject[0].doclanguage.Length -ge 1 | Should-Be $true # Field names like DOC-LANGUAGE get stripped of the hyphen, otherwise you get $ishObject.'doc-language' and now you get the more readable $ishObject.doclanguage + $ishObject[0].doclanguage_lng_element.StartsWith('VLANGUAGE') | Should-Be $true + $ishObject[0].fishstatustype -ge 0 | Should-Be $true # Basic does not return FISHSTATUSTYPE but extra RequestedMetadata parameter does } It "Parameter Count" { $count = Search-IshDocumentObj -XmlQuery $xmlQueryAllVersions -Count - $count -ge 0 | Should -Be $true + $count -ge 0 | Should-Be $true } It "Search-IshDocumentObj returns IshObject objects" { $ishObject = Search-IshDocumentObj -IShSession $ishSession -MaxHitsToReturn 2 -XmlQuery $xmlQueryLatestVersion - $ishObject[0].IshField | Should -Not -BeNullOrEmpty - $ishObject[0].IshRef | Should -Not -BeNullOrEmpty - $ishObject[0].IshType | Should -Not -BeNullOrEmpty - $ishObject[0].ObjectRef | Should -Not -BeNullOrEmpty - $ishObject[0].VersionRef | Should -Not -BeNullOrEmpty - $ishObject[0].LngRef | Should -Not -BeNullOrEmpty - $ishObject[0].fishstatustype -ge 0 | Should -Be $false # Basic does not return FISHSTATUSTYPE but extra RequestedMetadata parameter does + $ishObject[0].IshField | Should-NotBeNull + $ishObject[0].IshRef | Should-NotBeNull + $ishObject[0].IshType | Should-NotBeNull + $ishObject[0].ObjectRef | Should-NotBeNull + $ishObject[0].VersionRef | Should-NotBeNull + $ishObject[0].LngRef | Should-NotBeNull + $ishObject[0].fishstatustype -ge 0 | Should-Be $false # Basic does not return FISHSTATUSTYPE but extra RequestedMetadata parameter does } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/SetIshDocumentObj.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/SetIshDocumentObj.Tests.ps1 index aab9668..f0da034 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/SetIshDocumentObj.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/SetIshDocumentObj.Tests.ps1 @@ -71,43 +71,43 @@ Describe "Set-IshDocumentObj" -Tags "Create" { -Metadata $ishMetadataFieldsSet } It "GetType().Name" { - $ishObject.GetType().Name | Should -BeExactly "IshDocumentObj" + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshDocumentObj" } It "ishObject.IshData" { { $ishObject.IshData } | Should -Not -Throw } It "ishObject.IshField" { - $ishObject.IshField | Should -Not -BeNullOrEmpty + $ishObject.IshField | Should-NotBeNull } It "ishObject.IshRef" { - $ishObject.IshRef | Should -Not -BeNullOrEmpty + $ishObject.IshRef | Should-NotBeNull } It "ishObject.IshType" { - $ishObject.IshType | Should -Not -BeNullOrEmpty + $ishObject.IshType | Should-NotBeNull } It "ishObject.ObjectRef" { - $ishObject.ObjectRef | Should -Not -BeNullOrEmpty + $ishObject.ObjectRef | Should-NotBeNull } It "ishObject.VersionRef" { - $ishObject.VersionRef | Should -Not -BeNullOrEmpty + $ishObject.VersionRef | Should-NotBeNull } It "ishObject.LngRef" { - $ishObject.LngRef | Should -Not -BeNullOrEmpty + $ishObject.LngRef | Should-NotBeNull } It "ishObject ConvertTo-Json" { - (ConvertTo-Json $ishObject).Length -gt 2 | Should -Be $true + (ConvertTo-Json $ishObject).Length -gt 2 | Should-Be $true } It "Option IshSession.DefaultRequestedMetadata" { - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" #logical - $ishObject.ftitle_logical_value.Length -ge 1 | Should -Be $true + $ishObject.ftitle_logical_value.Length -ge 1 | Should-Be $true #version - $ishObject.version_version_value.Length -ge 1 | Should -Be $true + $ishObject.version_version_value.Length -ge 1 | Should-Be $true #language - $ishObject.fstatus.Length -ge 1 | Should -Be $true - $ishObject.fstatus_lng_element.StartsWith('VSTATUS') | Should -Be $true - $ishObject.doclanguage.Length -ge 1 | Should -Be $true # Field names like DOC-LANGUAGE get stripped of the hyphen, otherwise you get $ishObject.'doc-language' and now you get the more readable $ishObject.doclanguage - $ishObject.doclanguage_lng_element.StartsWith('VLANGUAGE') | Should -Be $true + $ishObject.fstatus.Length -ge 1 | Should-Be $true + $ishObject.fstatus_lng_element.StartsWith('VSTATUS') | Should-Be $true + $ishObject.doclanguage.Length -ge 1 | Should-Be $true # Field names like DOC-LANGUAGE get stripped of the hyphen, otherwise you get $ishObject.'doc-language' and now you get the more readable $ishObject.doclanguage + $ishObject.doclanguage_lng_element.StartsWith('VLANGUAGE') | Should-Be $true } } Context "Set-IshDocumentObj ParameterGroupMetadata" { @@ -116,7 +116,7 @@ Describe "Set-IshDocumentObj" -Tags "Create" { {Set-IshDocumentObj -IshSession $ishSession ` -Version "1" ` -Lng "en" ` - -Metadata $ishMetadataFieldsSet} | Should -Throw + -Metadata $ishMetadataFieldsSet} | Should-Throw } It "Mandatory parameter: Version" { $ishTopicMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "Topic $timestamp" | @@ -128,7 +128,7 @@ Describe "Set-IshDocumentObj" -Tags "Create" { {Set-IshDocumentObj -IshSession $ishSession ` -LogicalId $ishObjectToUpdate.IshRef ` -Lng "en" ` - -Metadata $ishMetadataFieldsSet} | Should -Throw + -Metadata $ishMetadataFieldsSet} | Should-Throw } It "Mandatory parameter: Lng" { $ishTopicMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "Topic $timestamp" | @@ -140,7 +140,7 @@ Describe "Set-IshDocumentObj" -Tags "Create" { {Set-IshDocumentObj -IshSession $ishSession ` -LogicalId $ishObjectToUpdate.IshRef ` -Version $ishObjectToUpdate.version_version_value ` - -Metadata $ishMetadataFieldsSet} | Should -Throw + -Metadata $ishMetadataFieldsSet} | Should-Throw } It "Topic - metadata update" { $ishTopicMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "Topic $timestamp" | @@ -155,7 +155,7 @@ Describe "Set-IshDocumentObj" -Tags "Create" { -Version $ishObjectToUpdate.version_version_value ` -Lng $ishObjectToUpdate.doclanguage ` -Metadata $ishMetadataFieldsSet - $ishObject.ftitle_logical_value | Should -Be $updatedTitle + $ishObject.ftitle_logical_value | Should-Be $updatedTitle } It "Topic - metadata update with RequiredCurrentMetadata accepted" { $ishTopicMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "Topic $timestamp" | @@ -172,7 +172,7 @@ Describe "Set-IshDocumentObj" -Tags "Create" { -Lng $ishObjectToUpdate.doclanguage ` -Metadata $ishMetadataFieldsSet ` -RequiredCurrentMetadata $ishRequiredCurrentMetadata - $ishObject.ftitle_logical_value | Should -Be $updatedTitle + $ishObject.ftitle_logical_value | Should-Be $updatedTitle } It "Topic - metadata update with RequiredCurrentMetadata rejected" { $ishTopicMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "Topic $timestamp" | @@ -188,11 +188,11 @@ Describe "Set-IshDocumentObj" -Tags "Create" { -Version $ishObjectToUpdate.version_version_value ` -Lng $ishObjectToUpdate.doclanguage ` -Metadata $ishMetadataFieldsSet ` - -RequiredCurrentMetadata $ishRequiredCurrentMetadata } | Should -Throw -PassThru + -RequiredCurrentMetadata $ishRequiredCurrentMetadata } | Should-Throw "The supplied expected metadata" # 14.0.4 message is: [-106011] The supplied expected metadata value "Released" does not match the current database value "In progress" so we rolled back your operation. To make the operation work you should make sure your value matches the latest database value. [f:158 fe:FSTATUS ft:LOV] [106011;InvalidCurrentMetadata] - $exception -like "*106011*" | Should -Be $true - $exception -like "*InvalidCurrentMetadata*" | Should -Be $true + $exception -like "*106011*" | Should-Be $true + $exception -like "*InvalidCurrentMetadata*" | Should-Be $true } It "Image - metadata update without Resolution" { $ishImageMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "Image $timestamp" | @@ -216,7 +216,7 @@ Describe "Set-IshDocumentObj" -Tags "Create" { -Version $ishObjectToUpdate.version_version_value ` -Lng $ishObjectToUpdate.doclanguage ` -Metadata $ishMetadataFieldsSet - $ishObject.ftitle_logical_value | Should -Be $updatedTitle + $ishObject.ftitle_logical_value | Should-Be $updatedTitle } It "Image - metadata update with Resolution" { $ishImageMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "Image $timestamp" | @@ -241,7 +241,7 @@ Describe "Set-IshDocumentObj" -Tags "Create" { -Lng $ishObjectToUpdate.doclanguage ` -Resolution $ishResolution ` -Metadata $ishMetadataFieldsSet - $ishObject.ftitle_logical_value | Should -Be $updatedTitle + $ishObject.ftitle_logical_value | Should-Be $updatedTitle } It "Image - metadata update with non-matching Resolution" { $ishImageMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "Image $timestamp" | @@ -265,10 +265,10 @@ Describe "Set-IshDocumentObj" -Tags "Create" { -Version $ishObjectToUpdate.version_version_value ` -Lng $ishObjectToUpdate.doclanguage ` -Resolution "VRESHIGH" ` - -Metadata $ishMetadataFieldsSet } | Should -Throw -PassThru + -Metadata $ishMetadataFieldsSet } | Should-Throw # 14.0.4 message is: [-102] The object GUID-862BD02A-422D-4E42-8626-725A12CF6D3A=3=en=High does not exist. [co:"GUID-862BD02A-422D-4E42-8626-725A12CF6D3A=3=en=High"] [102;ObjectNotFound] - $exception -like "*102*" | Should -Be $true - $exception -like "*ObjectNotFound*" | Should -Be $true + $exception -like "*102*" | Should-Be $true + $exception -like "*ObjectNotFound*" | Should-Be $true } } Context "Set-IshDocumentObj ParameterGroupFileContent" { @@ -286,10 +286,10 @@ Describe "Set-IshDocumentObj" -Tags "Create" { -Lng $ishObjectToUpdate.doclanguage ` -Metadata $ishMetadataFieldsSet ` -Edt "EDTJPEG" ` - -FileContent "INVALIDFILECONTENT" } | Should -Throw -PassThru + -FileContent "INVALIDFILECONTENT" } | Should-Throw # ISHRemote message is: FileContent parameter is only supported with EDT[EDTXML], not EDT[EDTJPEG]. - $exception -like "*FileContent*" | Should -Be $true - $exception -like "*EDTXML*" | Should -Be $true + $exception -like "*FileContent*" | Should-Be $true + $exception -like "*EDTXML*" | Should-Be $true } It "Parameter FileContent has invalid xml content" { $ishMetadataFieldsSet = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level "Logical" -Value "Updated title" @@ -299,7 +299,7 @@ Describe "Set-IshDocumentObj" -Tags "Create" { -Lng $ishObjectToUpdate.doclanguage ` -Metadata $ishMetadataFieldsSet ` -FileContent "INVALIDFILECONTENT"} | - Should -Throw "Data at the root level is invalid. Line 1, position 1." + Should-Throw -ExceptionMessage "Data at the root level is invalid. Line 1, position 1." } It "Provide both FileContent and FilePath" { $tempFilePath = (New-TemporaryFile).FullName @@ -310,8 +310,8 @@ Describe "Set-IshDocumentObj" -Tags "Create" { -Lng $ishObjectToUpdate.doclanguage ` -Metadata $ishMetadataFieldsSet ` -FileContent $ditaTopicFileContent ` - -FilePath $tempFilePath } | Should -Throw -PassThru - $exception -like "*Parameter set cannot be resolved using the specified named parameters.*" | Should -Be $true + -FilePath $tempFilePath } | Should-Throw + $exception -like "*Parameter set cannot be resolved using the specified named parameters.*" | Should-Be $true } It "Topic - update blob only" { $ishTopicMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "Set All Parameters Topic $timestamp" | @@ -337,7 +337,7 @@ Describe "Set-IshDocumentObj" -Tags "Create" { -FileContent $updatedContent $fileInfo = $ishObject | Get-IshDocumentObjData -IshSession $ishSession -FolderPath (Join-Path $tempFolder $cmdletName) [string]$ishObjectContent = Get-Content -Path $fileInfo - $ishObjectContent -eq $updatedContent | Should -Be $true + $ishObjectContent -eq $updatedContent | Should-Be $true } It "Topic - update blob and metadata" { $ishTopicMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "Set All Parameters Topic $timestamp" | @@ -366,8 +366,8 @@ Describe "Set-IshDocumentObj" -Tags "Create" { $fileInfo = $ishObject | Get-IshDocumentObjData -IshSession $ishSession -FolderPath (Join-Path $tempFolder $cmdletName) [string]$ishObjectContent = Get-Content -Path $fileInfo - $ishObject.ftitle_logical_value | Should -Be $updatedTitle - $ishObjectContent -eq $updatedContent | Should -Be $true + $ishObject.ftitle_logical_value | Should-Be $updatedTitle + $ishObjectContent -eq $updatedContent | Should-Be $true } It "Topic - update (RequiredCurrentMetadata accepted)" { $ishTopicMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "Topic update with RequiredCurrentMetadata accepted $timestamp" | @@ -398,8 +398,8 @@ Describe "Set-IshDocumentObj" -Tags "Create" { $fileInfo = $ishObject | Get-IshDocumentObjData -IshSession $ishSession -FolderPath (Join-Path $tempFolder $cmdletName) [string]$ishObjectContent = Get-Content -Path $fileInfo - $ishObject.ftitle_logical_value | Should -Be $updatedTitle - $ishObjectContent -eq $updatedContent | Should -Be $true + $ishObject.ftitle_logical_value | Should-Be $updatedTitle + $ishObjectContent -eq $updatedContent | Should-Be $true } It "Topic - update (RequiredCurrentMetadata rejected)" { $ishTopicMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "Topic update with RequiredCurrentMetadata rejected $timestamp" | @@ -426,10 +426,10 @@ Describe "Set-IshDocumentObj" -Tags "Create" { -Lng $ishObjectToUpdate.doclanguage ` -Metadata $ishMetadataFieldsSet ` -RequiredCurrentMetadata $ishRequiredCurrentMetadata ` - -FileContent $updatedContent } | Should -Throw -PassThru + -FileContent $updatedContent } | Should-Throw # 14.0.4 message is: [-106011] The supplied expected metadata value "Released" does not match the current database value "In progress" so we rolled back your operation. To make the operation work you should make sure your value matches the latest database value. [f:158 fe:FSTATUS ft:LOV] [106011;InvalidCurrentMetadata] - $exception -like "*106011*" | Should -Be $true - $exception -like "*InvalidCurrentMetadata*" | Should -Be $true + $exception -like "*106011*" | Should-Be $true + $exception -like "*InvalidCurrentMetadata*" | Should-Be $true } It "Map - update blob and metadata" { $ishMapMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "Map update $timestamp" | @@ -458,8 +458,8 @@ Describe "Set-IshDocumentObj" -Tags "Create" { $fileInfo = $ishObject | Get-IshDocumentObjData -IshSession $ishSession -FolderPath (Join-Path $tempFolder $cmdletName) [string]$ishObjectContent = Get-Content -Path $fileInfo - $ishObject.ftitle_logical_value | Should -Be $updatedTitle - $ishObjectContent -eq $updatedContent | Should -Be $true + $ishObject.ftitle_logical_value | Should-Be $updatedTitle + $ishObjectContent -eq $updatedContent | Should-Be $true } It "Lib - update blob and metadata" { @@ -489,8 +489,8 @@ Describe "Set-IshDocumentObj" -Tags "Create" { $fileInfo = $ishObject | Get-IshDocumentObjData -IshSession $ishSession -FolderPath (Join-Path $tempFolder $cmdletName) [string]$ishObjectContent = Get-Content -Path $fileInfo - $ishObject.ftitle_logical_value | Should -Be $updatedTitle - $ishObjectContent -eq $updatedContent | Should -Be $true + $ishObject.ftitle_logical_value | Should-Be $updatedTitle + $ishObjectContent -eq $updatedContent | Should-Be $true } } Context "Set-IshDocumentObj ParameterGroupFilePath" { @@ -518,7 +518,7 @@ Describe "Set-IshDocumentObj" -Tags "Create" { -FilePath $tempFilePathImage200x200 $fileInfo = $ishObject | Get-IshDocumentObjData -IshSession $ishSession -FolderPath (Join-Path $tempFolder $cmdletName) - $fileInfoToUpdate.Length -lt $fileInfo.Length | Should -Be $true + $fileInfoToUpdate.Length -lt $fileInfo.Length | Should-Be $true } It "Image - update metadata and blob (providing EDT)" { $ishImageMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "Mandatory parameters Image $timestamp" | @@ -549,8 +549,8 @@ Describe "Set-IshDocumentObj" -Tags "Create" { $fileInfo = $ishObject | Get-IshDocumentObjData -IshSession $ishSession -FolderPath (Join-Path $tempFolder $cmdletName) - $ishObject.ftitle_logical_value | Should -Be $updatedTitle - $fileInfoToUpdate.Length -lt $fileInfo.Length | Should -Be $true + $ishObject.ftitle_logical_value | Should-Be $updatedTitle + $fileInfoToUpdate.Length -lt $fileInfo.Length | Should-Be $true } It "Image - update metadata and blob providing EDT, RequiredCurrentMetadata accepted" { $ishImageMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "Mandatory parameters Image with RequiredCurrentMetadata $timestamp" | @@ -583,8 +583,8 @@ Describe "Set-IshDocumentObj" -Tags "Create" { $fileInfo = $ishObject | Get-IshDocumentObjData -IshSession $ishSession -FolderPath (Join-Path $tempFolder $cmdletName) - $ishObject.ftitle_logical_value | Should -Be $updatedTitle - $fileInfoToUpdate.Length -lt $fileInfo.Length | Should -Be $true + $ishObject.ftitle_logical_value | Should-Be $updatedTitle + $fileInfoToUpdate.Length -lt $fileInfo.Length | Should-Be $true } It "Topic - update metadata and blob, RequiredCurrentMetadata rejected" { $ishTopicMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "Topic update with RequiredCurrentMetadata rejected $timestamp" | @@ -613,12 +613,12 @@ Describe "Set-IshDocumentObj" -Tags "Create" { -Lng $ishObjectToUpdate.doclanguage ` -Metadata $ishMetadataFieldsSet ` -RequiredCurrentMetadata $ishRequiredCurrentMetadata ` - -FilePath $tempFilePathUpdated } | Should -Throw -PassThru + -FilePath $tempFilePathUpdated } | Should-Throw # 14.0.4 message is: [-106011] The supplied expected metadata value "Released" does not match the current database value "In progress" so we rolled back your operation. To make the operation work you should make sure your value matches the latest database value. [f:158 fe:FSTATUS ft:LOV] [106011;InvalidCurrentMetadata] # 14.0.4 message with pretranslation enabled is: [-106021] The target xml file handler "PreTranslation" returned the following error: "There is no Unicode byte order mark. Cannot switch to Unicode." [106021;TargetXmlFileHandlerExecutionFailure] # 14.0.4 message is: There is no Unicode byte order mark. Cannot switch to Unicode. - $exception -like "*106011*" | Should -Be $true - $exception -like "*InvalidCurrentMetadata*" | Should -Be $true + $exception -like "*106011*" | Should-Be $true + $exception -like "*InvalidCurrentMetadata*" | Should-Be $true } It "Update Other like EDT-TEXT" { $ishOtherMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "Update Other like EDT-TEXT $timestamp" | @@ -641,8 +641,8 @@ Describe "Set-IshDocumentObj" -Tags "Create" { -FilePath $tempFilePath $fileInfo = $ishObject | Get-IshDocumentObjData -IshSession $ishSession -FolderPath (Join-Path $tempFolder $cmdletName) - $ishObject.ftitle_logical_value | Should -Be $updatedTitle - $fileInfoToUpdate.Length -lt $fileInfo.Length | Should -Be $true + $ishObject.ftitle_logical_value | Should-Be $updatedTitle + $fileInfoToUpdate.Length -lt $fileInfo.Length | Should-Be $true } } Context "Set-IshDocumentObj IshObjectGroup" { @@ -657,19 +657,19 @@ Describe "Set-IshDocumentObj" -Tags "Create" { } It "Parameter IshObject invalid" { { Set-IshDocumentObj -IshSession $ishSession -IshObject "INVALIDISHOBJECT" } | - Should -Throw "Cannot bind parameter 'IshObject'. Cannot convert the ""INVALIDISHOBJECT"" value of type ""System.String"" to type ""Trisoft.ISHRemote.Objects.Public.IshObject""." + Should-Throw -ExceptionMessage "Cannot bind parameter 'IshObject'. Cannot convert the ""INVALIDISHOBJECT"" value of type ""System.String"" to type ""Trisoft.ISHRemote.Objects.Public.IshObject""." } It "Provide as parameter/pipe deleted object" { $ishObjectToUpdate = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderTopic -IshType ISHModule -Lng $ishLng -Metadata $ishTopicMetadata -FileContent $ditaTopicFileContent Remove-IshDocumentObj -IshSession $ishSession -IshObject $ishObjectToUpdate -Force - $exception = { $ishObjectSet = Set-IshDocumentObj -IshSession $ishSession -IshObject $ishObjectToUpdate } | Should -Throw -PassThru + $exception = { $ishObjectSet = Set-IshDocumentObj -IshSession $ishSession -IshObject $ishObjectToUpdate } | Should-Throw # 14.0.4 message is: [-102] The object GUID-862BD02A-422D-4E42-8626-725A12CF6D3A=3=en=High does not exist. [co:"GUID-862BD02A-422D-4E42-8626-725A12CF6D3A=3=en=High"] [102;ObjectNotFound] - $exception -like "*102*" | Should -Be $true - $exception -like "*ObjectNotFound*" | Should -Be $true - $exception = { $ishObjectSet = $ishObjectToUpdate | Set-IshDocumentObj -IshSession $ishSession } | Should -Throw -PassThru + $exception -like "*102*" | Should-Be $true + $exception -like "*ObjectNotFound*" | Should-Be $true + $exception = { $ishObjectSet = $ishObjectToUpdate | Set-IshDocumentObj -IshSession $ishSession } | Should-Throw # 14.0.4 message is: [-102] The object GUID-862BD02A-422D-4E42-8626-725A12CF6D3A=3=en=High does not exist. [co:"GUID-862BD02A-422D-4E42-8626-725A12CF6D3A=3=en=High"] [102;ObjectNotFound] - $exception -like "*102*" | Should -Be $true - $exception -like "*ObjectNotFound*" | Should -Be $true + $exception -like "*102*" | Should-Be $true + $exception -like "*ObjectNotFound*" | Should-Be $true } It "Set metadata, provide multiple objects to IshObject" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "ED" -Level Lng @@ -684,11 +684,11 @@ Describe "Set-IshDocumentObj" -Tags "Create" { $ishObjectAUpdated = $ishObjectA | Get-IshDocumentObj -IshSession $ishSession -RequestedMetadata $requestedMetadata $ishObjectBUpdated = $ishObjectB | Get-IshDocumentObj -IshSession $ishSession -RequestedMetadata $requestedMetadata - $ishObjectArray.Count | Should -Be 2 - $ishObjectA.ed -eq $ishObjectAUpdated.ed | Should -Be $true - $ishObjectB.ed -eq $ishObjectBUpdated.ed | Should -Be $true - $ishObjectArray[0].ftitle_logical_value | Should -Be $updatedTitle - $ishObjectArray[1].ftitle_logical_value | Should -Be $updatedTitle + $ishObjectArray.Count | Should-Be 2 + $ishObjectA.ed -eq $ishObjectAUpdated.ed | Should-Be $true + $ishObjectB.ed -eq $ishObjectBUpdated.ed | Should-Be $true + $ishObjectArray[0].ftitle_logical_value | Should-Be $updatedTitle + $ishObjectArray[1].ftitle_logical_value | Should-Be $updatedTitle } It "Resubmit blob, provide multiple objects to IshObject" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "ED" -Level Lng @@ -701,9 +701,9 @@ Describe "Set-IshDocumentObj" -Tags "Create" { $ishObjectAUpdated = $ishObjectA | Get-IshDocumentObj -IshSession $ishSession -RequestedMetadata $requestedMetadata $ishObjectBUpdated = $ishObjectB | Get-IshDocumentObj -IshSession $ishSession -RequestedMetadata $requestedMetadata - $ishObjectArray.Count | Should -Be 2 - $ishObjectA.ed -ne $ishObjectAUpdated.ed | Should -Be $true - $ishObjectB.ed -ne $ishObjectBUpdated.ed | Should -Be $true + $ishObjectArray.Count | Should-Be 2 + $ishObjectA.ed -ne $ishObjectAUpdated.ed | Should-Be $true + $ishObjectB.ed -ne $ishObjectBUpdated.ed | Should-Be $true } It "Resubmit blob, provide multiple objects via pipeline" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "ED" -Level Lng @@ -717,9 +717,9 @@ Describe "Set-IshDocumentObj" -Tags "Create" { $ishObjectAUpdated = $ishObjectA | Get-IshDocumentObj -IshSession $ishSession -RequestedMetadata $requestedMetadata $ishObjectBUpdated = $ishObjectB | Get-IshDocumentObj -IshSession $ishSession -RequestedMetadata $requestedMetadata - $ishObjectArray.Count | Should -Be 2 - $ishObjectA.ed -ne $ishObjectAUpdated.ed | Should -Be $true - $ishObjectB.ed -ne $ishObjectBUpdated.ed | Should -Be $true + $ishObjectArray.Count | Should-Be 2 + $ishObjectA.ed -ne $ishObjectAUpdated.ed | Should-Be $true + $ishObjectB.ed -ne $ishObjectBUpdated.ed | Should-Be $true } It "Resubmit blob, provide multiple objects via pipeline with RequiredCurrentMetadata accepted" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "ED" -Level Lng @@ -734,9 +734,9 @@ Describe "Set-IshDocumentObj" -Tags "Create" { $ishObjectAUpdated = $ishObjectA | Get-IshDocumentObj -IshSession $ishSession -RequestedMetadata $requestedMetadata $ishObjectBUpdated = $ishObjectB | Get-IshDocumentObj -IshSession $ishSession -RequestedMetadata $requestedMetadata - $ishObjectArray.Count | Should -Be 2 - $ishObjectA.ed -ne $ishObjectAUpdated.ed | Should -Be $true - $ishObjectB.ed -ne $ishObjectBUpdated.ed | Should -Be $true + $ishObjectArray.Count | Should-Be 2 + $ishObjectA.ed -ne $ishObjectAUpdated.ed | Should-Be $true + $ishObjectB.ed -ne $ishObjectBUpdated.ed | Should-Be $true } It "Resubmit blob, provide multiple objects via pipeline with RequiredCurrentMetadata rejected" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "ED" -Level Lng @@ -745,10 +745,10 @@ Describe "Set-IshDocumentObj" -Tags "Create" { $ishObjectAB = @($ishObjectA, $ishObjectB) | Get-IshDocumentObj -IshSession $ishSession -IncludeData $ishRequiredCurrentMetadata = Set-IshRequiredCurrentMetadataField -IshSession $ishSession -Name "FSTATUS" -Level Lng -ValueType Element -Value $ishStatusReleased - $exception = { $ishObjectAB | Set-IshDocumentObj -IshSession $ishSession -RequiredCurrentMetadata $ishRequiredCurrentMetadata } | Should -Throw -PassThru + $exception = { $ishObjectAB | Set-IshDocumentObj -IshSession $ishSession -RequiredCurrentMetadata $ishRequiredCurrentMetadata } | Should-Throw # 14.0.4 message is: [-106011] The supplied expected metadata value "Released" does not match the current database value "In progress" so we rolled back your operation. To make the operation work you should make sure your value matches the latest database value. [f:158 fe:FSTATUS ft:LOV] [106011;InvalidCurrentMetadata] - $exception -like "*106011*" | Should -Be $true - $exception -like "*InvalidCurrentMetadata*" | Should -Be $true + $exception -like "*106011*" | Should-Be $true + $exception -like "*InvalidCurrentMetadata*" | Should-Be $true } It "Resubmit blob and set Metadata, provide multiple objects via pipeline" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "ED" -Level Lng @@ -764,11 +764,11 @@ Describe "Set-IshDocumentObj" -Tags "Create" { $ishObjectAUpdated = $ishObjectA | Get-IshDocumentObj -IshSession $ishSession -RequestedMetadata $requestedMetadata $ishObjectBUpdated = $ishObjectB | Get-IshDocumentObj -IshSession $ishSession -RequestedMetadata $requestedMetadata - $ishObjectArray.Count | Should -Be 2 - $ishObjectA.ed -ne $ishObjectAUpdated.ed | Should -Be $true - $ishObjectB.ed -ne $ishObjectBUpdated.ed | Should -Be $true - $ishObjectArray[0].ftitle_logical_value | Should -Be $updatedTitle - $ishObjectArray[1].ftitle_logical_value | Should -Be $updatedTitle + $ishObjectArray.Count | Should-Be 2 + $ishObjectA.ed -ne $ishObjectAUpdated.ed | Should-Be $true + $ishObjectB.ed -ne $ishObjectBUpdated.ed | Should-Be $true + $ishObjectArray[0].ftitle_logical_value | Should-Be $updatedTitle + $ishObjectArray[1].ftitle_logical_value | Should-Be $updatedTitle } It "Resubmit blob and set Metadata, provide single object via pipeline" { $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "ED" -Level Lng @@ -786,8 +786,8 @@ Describe "Set-IshDocumentObj" -Tags "Create" { Set-IshDocumentObj -IshSession $ishSession -Metadata $ishMetadataFieldsSet | Get-IshDocumentObj -IshSession $ishSession -RequestedMetadata $requestedMetadata - $ishObjectToUpdate.ed -ne $ishObject.ed | Should -Be $true - $ishObject.ftitle_logical_value | Should -Be $updatedTitle + $ishObjectToUpdate.ed -ne $ishObject.ed | Should-Be $true + $ishObject.ftitle_logical_value | Should-Be $updatedTitle } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EventMonitor/GetIshEvent.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EventMonitor/GetIshEvent.Tests.ps1 index 12fa9b5..a3d6722 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EventMonitor/GetIshEvent.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EventMonitor/GetIshEvent.Tests.ps1 @@ -128,96 +128,96 @@ Describe "Get-IshEvent" -Tags "Create" { $ishEvent = (GetIshEvents -ishSession $ishSession -userFilter All -requestedMetadata $metadata)[0] } It "GetType().Name" { - $ishEvent.GetType().Name | Should -BeExactly "IshEvent" + $ishEvent.GetType().Name | Should-BeString -CaseSensitive "IshEvent" } It "ishObject.IshField" { - $ishEvent.IshField | Should -Not -BeNullOrEmpty + $ishEvent.IshField | Should-NotBeNull } It "ishObject.IshRef" { - $ishEvent.IshRef | Should -Not -BeNullOrEmpty + $ishEvent.IshRef | Should-NotBeNull } # Double check following 2 ReferenceType enum usage It "ishEvent.ProgressRef" { - $ishEvent.ProgressRef | Should -Not -BeNullOrEmpty + $ishEvent.ProgressRef | Should-NotBeNull } #It "ishEvent.DetailRef" { # Requires BackgroundTask to be running to get detail entries - # $ishEvent.DetailRef | Should -Not -BeNullOrEmpty + # $ishEvent.DetailRef | Should-NotBeNull #} It "ishEvent ConvertTo-Json" { - (ConvertTo-Json $ishEvent).Length -gt 2 | Should -Be $true + (ConvertTo-Json $ishEvent).Length -gt 2 | Should-Be $true } It "Parameter IshSession/ModifiedSince/UserFilter invalid" { - { Get-IshEvent -IShSession "INVALIDISHSESSION" -ModifiedSince "INVALIDDATE" -UserFilter "INVALIDUSERFILTER" } | Should -Throw + { Get-IshEvent -IShSession "INVALIDISHSESSION" -ModifiedSince "INVALIDDATE" -UserFilter "INVALIDUSERFILTER" } | Should-Throw } It "Parameter RequestedMetadata/MetadataFile invalid" { - { Get-IshEvent -IShSession $ishSession -RequestedMetadata "INVALIDMETADATA" -MetadataFilter "INVALIDFILTER" } | Should -Throw + { Get-IshEvent -IShSession $ishSession -RequestedMetadata "INVALIDMETADATA" -MetadataFilter "INVALIDFILTER" } | Should-Throw } It "Parameter IshSession/UserFilter/MetadataFilter are optional" { $ishEvent = (GetIshEvents -ishSession $ishSession -requestedMetadata $allProgressMetadata)[0] - ($ishEvent | Get-IshMetadataField -IshSession $ishSession -Level Progress -Name EVENTID -ValueType Value).Length -gt 0 | Should -Be $true - #($ishEvent | Get-IshMetadataField -IshSession $ishSession -Level Progress -Name USERID -ValueType Element).StartsWith('VUSER') | Should -Be $false # unexpected but ValueType Element is not returned by the API call + ($ishEvent | Get-IshMetadataField -IshSession $ishSession -Level Progress -Name EVENTID -ValueType Value).Length -gt 0 | Should-Be $true + #($ishEvent | Get-IshMetadataField -IshSession $ishSession -Level Progress -Name USERID -ValueType Element).StartsWith('VUSER') | Should-Be $false # unexpected but ValueType Element is not returned by the API call } It "Option IshSession.DefaultRequestedMetadata" { $oldDefaultRequestedMetadata = $ishSession.DefaultRequestedMetadata $ishSession.DefaultRequestedMetadata = "Descriptive" $ishEvent = (GetIshEvents -IShSession $ishSession)[0] - $ishEvent.IshField.Count | Should -Be 2 + $ishEvent.IshField.Count | Should-Be 2 $ishSession.DefaultRequestedMetadata = "Basic" $ishEvent = (GetIshEvents -IShSession $ishSession)[0] - $ishEvent.status.Length -gt 0 | Should -Be $true + $ishEvent.status.Length -gt 0 | Should-Be $true if((([Version]$ishSession.ServerVersion).Major -eq 15 -and ([Version]$ishSession.ServerVersion).Minor -ge 1) -or ([Version]$ishSession.ServerVersion).Major -ge 16) { - $ishEvent.IshField.Count | Should -Be 10 + $ishEvent.IshField.Count | Should-Be 10 } else { - $ishEvent.IshField.Count | Should -Be 9 + $ishEvent.IshField.Count | Should-Be 9 } $ishSession.DefaultRequestedMetadata = "All" $ishEvent = (GetIshEvents -IShSession $ishSession)[0] if((([Version]$ishSession.ServerVersion).Major -eq 15 -and ([Version]$ishSession.ServerVersion).Minor -ge 1) -or ([Version]$ishSession.ServerVersion).Major -ge 16) { - $ishEvent.IshField.Count | Should -Be 11 + $ishEvent.IshField.Count | Should-Be 11 } else { - $ishEvent.IshField.Count | Should -Be 10 + $ishEvent.IshField.Count | Should-Be 10 } $ishSession.DefaultRequestedMetadata = $oldDefaultRequestedMetadata } It "Parameter ModifiedSince is now" { # a date in the future should yield no results - (Get-IshEvent -IshSession $ishSession -ModifiedSince ((Get-Date).AddMinutes(1)) -UserFilter All).Count | Should -Be 0 + (Get-IshEvent -IshSession $ishSession -ModifiedSince ((Get-Date).AddMinutes(1)) -UserFilter All).Count | Should-Be 0 } It "Parameter RequestedMetadata only all of Progress level" { $ishEvent = (GetIshEvents -ishSession $ishSession -userFilter All -requestedMetadata $allProgressMetadata)[0] - $ishEvent.ProgressRef -gt 0 | Should -Be $true - #$ishEvent.DetailRef -gt 0 | Should -Be $true + $ishEvent.ProgressRef -gt 0 | Should-Be $true + #$ishEvent.DetailRef -gt 0 | Should-Be $true if((([Version]$ishSession.ServerVersion).Major -eq 15 -and ([Version]$ishSession.ServerVersion).Minor -ge 1) -or ([Version]$ishSession.ServerVersion).Major -ge 16) { - $ishEvent.IshField.Count | Should -Be 12 + $ishEvent.IshField.Count | Should-Be 12 } else { - $ishEvent.IshField.Count | Should -Be 10 + $ishEvent.IshField.Count | Should-Be 10 } } It "Parameter RequestedMetadata only all of Detail level" { $ishEvent = (GetIshEvents -ishSession $ishSession -userFilter All -requestedMetadata $allDetailMetadata)[0] - $ishEvent.ProgressRef -gt 0 | Should -Be $true - $ishEvent.DetailRef -gt 0 | Should -Be $true - $ishEvent.IshField.Count -ge 20 | Should -Be $true # Perhaps expected 10 Progress level fields, but Get-IshEvent currently always retrieves details as well + $ishEvent.ProgressRef -gt 0 | Should-Be $true + $ishEvent.DetailRef -gt 0 | Should-Be $true + $ishEvent.IshField.Count -ge 20 | Should-Be $true # Perhaps expected 10 Progress level fields, but Get-IshEvent currently always retrieves details as well } It "Parameter RequestedMetadata PipelineObjectPreference=PSObjectNoteProperty" { - $ishSession.PipelineObjectPreference | Should -Be "PSObjectNoteProperty" + $ishSession.PipelineObjectPreference | Should-Be "PSObjectNoteProperty" $ishEvent = (GetIshEvents -ishSession $ishSession -userFilter All -requestedMetadata $allMetadata)[0] - $ishEvent.GetType().Name | Should -BeExactly "IshEvent" # and not PSObject - [bool]($ishEvent.PSobject.Properties.name -match "status") | Should -Be $true - [bool]($ishEvent.PSobject.Properties.name -match "userid") | Should -Be $true - [bool]($ishEvent.PSobject.Properties.name -match "modificationdate") | Should -Be $true - [bool]($ishEvent.PSobject.Properties.name -match "status_detail_value") | Should -Be $true - $ishEvent.modificationdate -like "*/*" | Should -Be $false # It should be sortable date format: yyyy-MM-ddTHH:mm:ss + $ishEvent.GetType().Name | Should-BeString -CaseSensitive "IshEvent" # and not PSObject + [bool]($ishEvent.PSobject.Properties.name -match "status") | Should-Be $true + [bool]($ishEvent.PSobject.Properties.name -match "userid") | Should-Be $true + [bool]($ishEvent.PSobject.Properties.name -match "modificationdate") | Should-Be $true + [bool]($ishEvent.PSobject.Properties.name -match "status_detail_value") | Should-Be $true + $ishEvent.modificationdate -like "*/*" | Should-Be $false # It should be sortable date format: yyyy-MM-ddTHH:mm:ss } It "Parameter RequestedMetadata PipelineObjectPreference=Off" { $pipelineObjectPreference = $ishSession.PipelineObjectPreference $ishSession.PipelineObjectPreference = "Off" $ishEvent = (GetIshEvents -ishSession $ishSession -userFilter All -requestedMetadata $allMetadata)[0] - $ishEvent.GetType().Name | Should -BeExactly "IshEvent" - [bool]($ishEvent.PSobject.Properties.name -match "status") | Should -Be $false - [bool]($ishEvent.PSobject.Properties.name -match "userid") | Should -Be $false - [bool]($ishEvent.PSobject.Properties.name -match "modificationdate") | Should -Be $false - [bool]($ishEvent.PSobject.Properties.name -match "status_detail_value") | Should -Be $false + $ishEvent.GetType().Name | Should-BeString -CaseSensitive "IshEvent" + [bool]($ishEvent.PSobject.Properties.name -match "status") | Should-Be $false + [bool]($ishEvent.PSobject.Properties.name -match "userid") | Should-Be $false + [bool]($ishEvent.PSobject.Properties.name -match "modificationdate") | Should-Be $false + [bool]($ishEvent.PSobject.Properties.name -match "status_detail_value") | Should-Be $false $ishSession.PipelineObjectPreference = $pipelineObjectPreference } It "Parameter MetadataFilter" { @@ -226,17 +226,17 @@ Describe "Get-IshEvent" -Tags "Create" { # | Set-IshMetadataFilterField -IshSession $ishSession -Level Progress -Name USERID -Value ($ishEvent | Get-IshMetadataField -IshSession $ishSession -Level Progress -Name USERID) # Seems just like higher that USERID by valuetype retrieval and filtering are not working $ishEventArray = Get-IshEvent -IshSession $ishSession -MetadataFilter $filterMetadata #Write-Host ("ishEvent.IshRef["+ $ishEvent.IshRef + "] ishEventArray.IshRef["+ $ishEvent.IshRef + "]") - $ishEventArray.Count -ge 1 | Should -Be $true + $ishEventArray.Count -ge 1 | Should-Be $true } It "Parameter IshEvent invalid" { - { Get-IshEvent -IshSession $ishSession -IshEvent "INVALIDISHEVENT" } | Should -Throw + { Get-IshEvent -IshSession $ishSession -IshEvent "INVALIDISHEVENT" } | Should-Throw } It "Parameter IshEvent Single" { $ishEvent = (GetIshEvents -ishSession $ishSession -userFilter Current)[0] $eventId = $ishEvent | Get-IshMetadataField -IshSession $ishSession -Level Progress -Name EVENTID $ishEventArray = Get-IshEvent -IshSession $ishSession -IshEvent $ishEvent - $ishEventArray.Count -ge 1 | Should -Be $true - $ishEventArray.IshRef | Should -Be $eventId + $ishEventArray.Count -ge 1 | Should-Be $true + $ishEventArray.IshRef | Should-Be $eventId } <# TODO [Could] It "Parameter IshEvent Multiple" { } @@ -245,8 +245,8 @@ Describe "Get-IshEvent" -Tags "Create" { $ishEvent = (GetIshEvents -ishSession $ishSession -userFilter Current)[0] $eventId = $ishEvent | Get-IshMetadataField -IshSession $ishSession -Level Progress -Name EVENTID $ishEventArray = $ishEvent | Get-IshEvent -IshSession $ishSession - $ishEventArray.Count -ge 1 | Should -Be $true - $ishEventArray.IshRef | Should -Be $eventId + $ishEventArray.Count -ge 1 | Should-Be $true + $ishEventArray.IshRef | Should-Be $eventId } <# TODO [Could] It "Pipeline IshEvent Multiple" { } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Field/GetIshMetadataField.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Field/GetIshMetadataField.Tests.ps1 index d0e3830..4c73b0f 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Field/GetIshMetadataField.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Field/GetIshMetadataField.Tests.ps1 @@ -92,73 +92,73 @@ Describe "Get-IshMetadataField" -Tags "Read" { Context "Get-IshMetadataField -IshSession ishSession returns String object" { It "GetType().Name" { $ishFolderData = Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshField $ishFolderDataOriginal.IshField - $ishFolderData.GetType().Name | Should -BeExactly "String" + $ishFolderData.GetType().Name | Should-BeString -CaseSensitive "String" } } Context "Get-IshMetadataField -IshSession ishSession IshFieldsGroup" { It "Parameter IshSession/Name invalid" { - { Get-IshMetadataField -IshSession "INVALIDISHSESSION" -Name "INVALIDFIELDNAME" } | Should -Throw + { Get-IshMetadataField -IshSession "INVALIDISHSESSION" -Name "INVALIDFIELDNAME" } | Should-Throw } It "Parameter Name invalid" { - { Get-IshMetadataField -IshSession $ishSession -Name "INVALIDFIELDNAME" } | Should -Throw + { Get-IshMetadataField -IshSession $ishSession -Name "INVALIDFIELDNAME" } | Should-Throw } It "Parameter Level invalid" { - { Get-IshMetadataField -IshSession $ishSession -Name "INVALIDFIELDNAME" -Level "INVALIDFIELDLEVEL" } | Should -Throw + { Get-IshMetadataField -IshSession $ishSession -Name "INVALIDFIELDNAME" -Level "INVALIDFIELDLEVEL" } | Should-Throw } It "Parameter ValueType invalid" { - { Get-IshMetadataField -IshSession $ishSession -Name "INVALIDFIELDNAME" -Level "INVALIDFIELDLEVEL" -ValueType "INVALIDFIELDVALUETYPE" } | Should -Throw + { Get-IshMetadataField -IshSession $ishSession -Name "INVALIDFIELDNAME" -Level "INVALIDFIELDLEVEL" -ValueType "INVALIDFIELDVALUETYPE" } | Should-Throw } It "Parameter IshFolder FNAME" { - Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshField $ishFolderSystemOriginal.IshField | Should -Not -BeNullOrEmpty + Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshField $ishFolderSystemOriginal.IshField | Should-NotBeNull } It "Parameter IshFolder FDOCUMENTTYPE" { - Get-IshMetadataField -IshSession $ishSession -Name "FDOCUMENTTYPE" -Level None -IshField $ishFolderSystemOriginal.IshField | Should -Be "None" + Get-IshMetadataField -IshSession $ishSession -Name "FDOCUMENTTYPE" -Level None -IshField $ishFolderSystemOriginal.IshField | Should-Be "None" } It "Parameter IshFolder READ-ACCESS with implicit IshSession" { - Get-IshMetadataField -Name "READ-ACCESS" -Level None -IshField $ishFolderSystemOriginal.IshField -ValueType Element | Should -BeNullOrEmpty + Get-IshMetadataField -Name "READ-ACCESS" -Level None -IshField $ishFolderSystemOriginal.IshField -ValueType Element | Should-BeEmptyString } } Context "Get-IshMetadataField -IshSession ishSession IshObjectGroup" { It "Parameter IshObject invalid" { - { Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshObject "INVALIDOBJECT" } | Should -Throw + { Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshObject "INVALIDOBJECT" } | Should-Throw } It "Parameter IshObject Single" { $ishUser = Get-IshUser -IshSession $ishSession -RequestedMetadata (Set-IshRequestedMetadataField -IshSession $ishSession -Name "USERNAME") - (Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshObject $ishUser).Count | Should -Be 1 + (Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshObject $ishUser).Count | Should-Be 1 } } Context "Get-IshMetadataField -IshSession ishSession IshFolderGroup" { It "Parameter IshFolder invalid" { - { Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshFolder "INVALIDFOLDER" } | Should -Throw + { Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshFolder "INVALIDFOLDER" } | Should-Throw } It "Parameter IshFolder Single" { - (Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshFolder $ishFolderDataOriginal).Count | Should -Be 1 + (Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshFolder $ishFolderDataOriginal).Count | Should-Be 1 } It "Parameter IshFolder Multiple" { - (Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshFolder @($ishFolderDataOriginal,$ishFolderFavoritesOriginal)).Count | Should -Be 2 + (Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshFolder @($ishFolderDataOriginal,$ishFolderFavoritesOriginal)).Count | Should-Be 2 } It "Pipeline IshFolder" { - (@($ishFolderDataOriginal) | Get-IshMetadataField -IshSession $ishSession -Name "FNAME").Count | Should -Be 1 + (@($ishFolderDataOriginal) | Get-IshMetadataField -IshSession $ishSession -Name "FNAME").Count | Should-Be 1 } It "Pipeline IshFolder Multiple" { - (@($ishFolderDataOriginal,$ishFolderFavoritesOriginal) | Get-IshMetadataField -IshSession $ishSession -Name "FNAME").Count | Should -Be 2 + (@($ishFolderDataOriginal,$ishFolderFavoritesOriginal) | Get-IshMetadataField -IshSession $ishSession -Name "FNAME").Count | Should-Be 2 } } Context "Get-IshMetadataField -IshSession ishSession IshEventGroup" { It "Parameter IshEvent invalid" { - { Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshEvent "INVALIDEVENT" } | Should -Throw + { Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshEvent "INVALIDEVENT" } | Should-Throw } It "Pipeline IshEvent Multiple" { #TODO test possibly is slow (or fails) when there are no EventMonitor entries - (GetIshEvents -IshSession $ishSession | Get-IshMetadataField -IshSession $ishSession -Name "EVENTTYPE" -Level Progress).Count -ge 0 | Should -Be $true + (GetIshEvents -IshSession $ishSession | Get-IshMetadataField -IshSession $ishSession -Name "EVENTTYPE" -Level Progress).Count -ge 0 | Should-Be $true } } Context "Get-IshMetadataField -IshSession ishSession IshBackgroundTask" { It "Parameter IshBackgroundTask invalid" { - { Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshBackgroundTask "INVALIDBACKGROUNDTASK" } | Should -Throw + { Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshBackgroundTask "INVALIDBACKGROUNDTASK" } | Should-Throw } It "Pipeline IshBackgroundTask Multiple" { - ((GetBackgroundTasks -ishSession $ishSession -userFilter All)[0] | Get-IshMetadataField -IshSession $ishSession -Name "EVENTTYPE" -Level Task).Count -ge 0 | Should -Be $true + ((GetBackgroundTasks -ishSession $ishSession -userFilter All)[0] | Get-IshMetadataField -IshSession $ishSession -Name "EVENTTYPE" -Level Task).Count -ge 0 | Should-Be $true } } Context "Get-IshMetadataField IshFields.ToXml() for API Testing" { @@ -172,18 +172,18 @@ Describe "Get-IshMetadataField" -Tags "Read" { $ishFields = New-Object -TypeName Trisoft.ISHRemote.Objects.IShFields $ishFields.AddField((Set-IshRequestedMetadataField -IshSession $ishSession -Name "USERNAME")) $result = '' - $ishFields.ToXML() -eq $result | Should -Be $true + $ishFields.ToXML() -eq $result | Should-Be $true } It "Trisoft.ISHRemote.Objects.IShFields.ToXml() xml content multiple" { $ishFields = New-Object -TypeName Trisoft.ISHRemote.Objects.IShFields $ishFields.AddField((Set-IshRequestedMetadataField -IshSession $ishSession -Name "USERNAME")) $ishFields.AddField((Set-IshRequestedMetadataField -IshSession $ishSession -Name "FUSERGROUP")) $result = '' - $ishFields.ToXML() -eq $result | Should -Be $true + $ishFields.ToXML() -eq $result | Should-Be $true } } } AfterAll { Write-Host ("Running "+$cmdletName+" Test Data and Variables cleanup") -} \ No newline at end of file +} diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Field/SetIshMetadataField.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Field/SetIshMetadataField.Tests.ps1 index 2bb320e..92dfe00 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Field/SetIshMetadataField.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Field/SetIshMetadataField.Tests.ps1 @@ -15,81 +15,81 @@ Describe "Set-IshMetadataField" -Tags "Read" { } Context "Set-IshMetadataField returns IshMetadataField" { It "GetType().Name" { - (Set-IshMetadataField -IshSession $ishSession -Name "FTITLE").GetType().Name | Should -BeExactly "IshMetadataField" + (Set-IshMetadataField -IshSession $ishSession -Name "FTITLE").GetType().Name | Should-BeString -CaseSensitive "IshMetadataField" } It "Parameter IshSession/Name/Level invalid" { - { Set-IshMetadataField -IshSession "INVALIDISHSESSION" -Name "INVALIDFIELDNAME" -Level "INVALIDFIELDLEVEL" } | Should -Throw + { Set-IshMetadataField -IshSession "INVALIDISHSESSION" -Name "INVALIDFIELDNAME" -Level "INVALIDFIELDLEVEL" } | Should-Throw } It "Parameter ValueType invalid" { - { Set-IshMetadataField -IshSession $ishSession -Name "INVALIDFIELDNAME" -Level "INVALIDFIELDLEVEL" -ValueType "INVALIDFIELDVALUETYPE" } | Should -Throw + { Set-IshMetadataField -IshSession $ishSession -Name "INVALIDFIELDNAME" -Level "INVALIDFIELDLEVEL" -ValueType "INVALIDFIELDVALUETYPE" } | Should-Throw } It "Parameter Name" { - Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" | Should -Be "" + Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" | Should-Be "" } It "Parameter Name Level" { - Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical | Should -Be "" + Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical | Should-Be "" } It "Parameter Name Level Value" { $value = "MyString" - (Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -value $value | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical) -eq $value | Should -Be $true + (Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -value $value | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical) -eq $value | Should-Be $true } It "Parameter Name Level ValueType Value" { $value = "MYSTRING" - (Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element -value $value | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element) -eq $value | Should -Be $true + (Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element -value $value | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element) -eq $value | Should-Be $true } It "Parameter Name Level ValueType Value Overwrite" { $value = "MYSTRING" (Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element -value "ValueThatWillBeOverwritten" | - Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element -value $value).Length | Should -Be 1 + Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element -value $value).Length | Should-Be 1 } It "Parameter IshFields Single Add" { $ishFields = $null $value = "SingleString" - (Set-IshMetadataField -IshSession $ishSession -IshField $ishFields -Name "FTITLE" -Level Logical -ValueType Element -value $value | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element) -eq $value | Should -Be $true + (Set-IshMetadataField -IshSession $ishSession -IshField $ishFields -Name "FTITLE" -Level Logical -ValueType Element -value $value | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element) -eq $value | Should-Be $true } It "Parameter IshFields Single Update" { $value = "OrginalString" $ishFields = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element -value $value $value = "NewString" - (Set-IshMetadataField -IshSession $ishSession -IshField $ishFields -Name "FTITLE" -Level Logical -ValueType Element -value $value | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element) -eq $value | Should -Be $true + (Set-IshMetadataField -IshSession $ishSession -IshField $ishFields -Name "FTITLE" -Level Logical -ValueType Element -value $value | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element) -eq $value | Should-Be $true } It "Parameter IshField Multiple duplicate entries will be removed" { $value = "OrginalString" $ishFieldA =Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element -value $value $ishFieldB =Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element -value $value $value = "SingleString" - (Set-IshMetadataField -IshSession $ishSession -IshField @($ishFieldA,$ishFieldB) -Name "FTITLE" -Level Logical -ValueType Element -value $value).Length | Should -Be 1 + (Set-IshMetadataField -IshSession $ishSession -IshField @($ishFieldA,$ishFieldB) -Name "FTITLE" -Level Logical -ValueType Element -value $value).Length | Should-Be 1 } It "Pipeline IshFields Single with implicit IshSession" { $value = "OrginalString" $ishFieldA =Set-IshMetadataField -Name "FTITLE" -Level Logical -ValueType Element -value $value $value = "SingleString" - ($ishFieldA | Set-IshMetadataField -Name "FTITLE" -Level Logical -ValueType Element -value $value | Get-IshMetadataField -Name "FTITLE" -Level Logical -ValueType Element) -eq $value | Should -Be $true + ($ishFieldA | Set-IshMetadataField -Name "FTITLE" -Level Logical -ValueType Element -value $value | Get-IshMetadataField -Name "FTITLE" -Level Logical -ValueType Element) -eq $value | Should-Be $true } It "Pipeline IshFields Multiple with implicit IshSession" { $value = "OrginalString" $ishFieldA =Set-IshMetadataField -Name "FTITLE" -Level Logical -ValueType Element -value $value $ishFieldB =Set-IshMetadataField -Name "FTITLE" -Level Logical -ValueType Element -value $value $value = "SingleString" - (@($ishFieldA,$ishFieldB) | Set-IshMetadataField -Name "FTITLE" -Level Logical -ValueType Element -value $value).Length | Should -Be 1 + (@($ishFieldA,$ishFieldB) | Set-IshMetadataField -Name "FTITLE" -Level Logical -ValueType Element -value $value).Length | Should-Be 1 } } Context "Set-IshMetadataField returns IshFolder" { It "GetType().Name" { - (Set-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshFolder $ishFolderDataOriginal).GetType().Name | Should -BeExactly "IshFolder" + (Set-IshMetadataField -IshSession $ishSession -Name "FNAME" -IshFolder $ishFolderDataOriginal).GetType().Name | Should-BeString -CaseSensitive "IshFolder" } It "Parameter Name Level ValueType Value" { $value = "MYSTRING" ($ishFolderDataOriginal | Set-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -ValueType Element -value $value | - Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -ValueType Element) -eq $value | Should -Be $true + Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -ValueType Element) -eq $value | Should-Be $true } } Context "Alias Set-IshRequiredCurrentMetadataField" { It "Parameter IshFields Single" { $ishFields = $null $value = "SingleString" - (Set-IshRequiredCurrentMetadataField -IshSession $ishSession -IshField $ishFields -Name "FTITLE" -Level Logical -ValueType Element -value $value | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element) -eq $value | Should -Be $true + (Set-IshRequiredCurrentMetadataField -IshSession $ishSession -IshField $ishFields -Name "FTITLE" -Level Logical -ValueType Element -value $value | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element) -eq $value | Should-Be $true } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Field/SetIshMetadataFilterField.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Field/SetIshMetadataFilterField.Tests.ps1 index 5143131..7c5960e 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Field/SetIshMetadataFilterField.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Field/SetIshMetadataFilterField.Tests.ps1 @@ -10,73 +10,73 @@ Describe "Set-IshMetadataFilterField" -Tags "Read" { Context "Set-IshMetadataFilterField -IshSession $ishSession returns IshMetadataFilterField" { It "GetType().Name" { - (Set-IshMetadataFilterField -IshSession $ishSession -Name "FTITLE").GetType().Name | Should -BeExactly "IshMetadataFilterField" + (Set-IshMetadataFilterField -IshSession $ishSession -Name "FTITLE").GetType().Name | Should-BeString -CaseSensitive "IshMetadataFilterField" } } Context "Set-IshMetadataFilterField" { It "Parameter IshSession/Name/Level invalid" { - { Set-IshMetadataFilterField -IshSession "INVALIDISHSESSION" -Name "INVALIDFIELDNAME" -Level "INVALIDFIELDLEVEL" } | Should -Throw + { Set-IshMetadataFilterField -IshSession "INVALIDISHSESSION" -Name "INVALIDFIELDNAME" -Level "INVALIDFIELDLEVEL" } | Should-Throw } It "Parameter ValueType invalid" { - { Set-IshMetadataFilterField -IshSession $ishSession -Name "INVALIDFIELDNAME" -Level "INVALIDFIELDLEVEL" -ValueType "INVALIDFIELDVALUETYPE" } | Should -Throw + { Set-IshMetadataFilterField -IshSession $ishSession -Name "INVALIDFIELDNAME" -Level "INVALIDFIELDLEVEL" -ValueType "INVALIDFIELDVALUETYPE" } | Should-Throw } It "Parameter Name" { - Set-IshMetadataFilterField -IshSession $ishSession -Name "FTITLE" | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" | Should -Be "" + Set-IshMetadataFilterField -IshSession $ishSession -Name "FTITLE" | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" | Should-Be "" } It "Parameter Name Level" { - Set-IshMetadataFilterField -IshSession $ishSession -Name "FTITLE" -Level Logical | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical | Should -Be "" + Set-IshMetadataFilterField -IshSession $ishSession -Name "FTITLE" -Level Logical | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical | Should-Be "" } It "Parameter Name Level Operator" { - Set-IshMetadataFilterField -IshSession $ishSession -Name "FTITLE" -Level Logical -FilterOperator Equal | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical | Should -Be "" + Set-IshMetadataFilterField -IshSession $ishSession -Name "FTITLE" -Level Logical -FilterOperator Equal | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical | Should-Be "" } It "Parameter Name Level Operator Value" { $value = "MyString" - (Set-IshMetadataFilterField -IshSession $ishSession -Name "FTITLE" -Level Logical -FilterOperator Equal -value $value | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical) -eq $value | Should -Be $true + (Set-IshMetadataFilterField -IshSession $ishSession -Name "FTITLE" -Level Logical -FilterOperator Equal -value $value | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical) -eq $value | Should-Be $true } It "Parameter Name Level Operator Value Twice" { (Set-IshMetadataFilterField -IshSession $ishSession -Name 'FISHLASTMODIFIEDON' -Level Lng -FilterOperator GreaterThanOrEqual -Value '01/01/2016' | - Set-IshMetadataFilterField -IshSession $ishSession -Name 'FISHLASTMODIFIEDON' -Level Lng -FilterOperator LessThan -Value '02/01/2016').Length | Should -Be 2 + Set-IshMetadataFilterField -IshSession $ishSession -Name 'FISHLASTMODIFIEDON' -Level Lng -FilterOperator LessThan -Value '02/01/2016').Length | Should-Be 2 } It "Parameter Name Level Operator ValueType Value" { $value = "VUSERADMIN" - (Set-IshMetadataFilterField -IshSession $ishSession -Name "FAUTHOR" -Level Lng -FilterOperator Equal -ValueType Element -value $value).FilterOperator -match 'equal' | Should -Be $true + (Set-IshMetadataFilterField -IshSession $ishSession -Name "FAUTHOR" -Level Lng -FilterOperator Equal -ValueType Element -value $value).FilterOperator -match 'equal' | Should-Be $true } It "Parameter Name Level Operator ValueType Value Twice" { $value = "VUSERADMIN" (Set-IshMetadataFilterField -IshSession $ishSession -Name 'FAUTHOR' -Level Lng -FilterOperator In -ValueType Element -Value $value | - Set-IshMetadataFilterField -IshSession $ishSession -Name 'FAUTHOR' -Level Lng -FilterOperator Equal -ValueType Element -Value $value).Length | Should -Be 2 + Set-IshMetadataFilterField -IshSession $ishSession -Name 'FAUTHOR' -Level Lng -FilterOperator Equal -ValueType Element -Value $value).Length | Should-Be 2 } It "Parameter IshFields Single Add" { $ishFields = $null $value = "SingleString" - (Set-IshMetadataFilterField -IshSession $ishSession -IshField $ishFields -Name "FTITLE" -Level Logical -ValueType Element -value $value | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element) -eq $value | Should -Be $true + (Set-IshMetadataFilterField -IshSession $ishSession -IshField $ishFields -Name "FTITLE" -Level Logical -ValueType Element -value $value | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element) -eq $value | Should-Be $true } It "Parameter IshFields Single Add Twice" { $firstFiltervalue = "OrginalString" $ishFields = Set-IshMetadataFilterField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element -value $firstFiltervalue $secondFiltervalue = "NewString" $result = Set-IshMetadataFilterField -IshSession $ishSession -IshField $ishFields -Name "FTITLE" -Level Logical -ValueType Element -value $secondFiltervalue | Get-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element - (($result -eq $firstFiltervalue) -or ($result -eq $secondFiltervalue)) | Should -Be $true + (($result -eq $firstFiltervalue) -or ($result -eq $secondFiltervalue)) | Should-Be $true } It "Parameter IshFields Multiple extra filter criteria are added" { $value = "OrginalString" $ishFieldA =Set-IshMetadataFilterField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element -value $value $ishFieldB =Set-IshMetadataFilterField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element -value $value $value = "SingleString" - (Set-IshMetadataFilterField -IshSession $ishSession -IshField @($ishFieldA,$ishFieldB) -Name "FTITLE" -Level Logical -ValueType Element -value $value).Length | Should -Be 3 + (Set-IshMetadataFilterField -IshSession $ishSession -IshField @($ishFieldA,$ishFieldB) -Name "FTITLE" -Level Logical -ValueType Element -value $value).Length | Should-Be 3 } It "Pipeline IshFields Single with implicit IshSession" { $ishFields = $null $value = "SingleString" - ($ishFields | Set-IshMetadataFilterField -Name "FTITLE" -Level Logical -ValueType Element -value $value | Get-IshMetadataField -Name "FTITLE" -Level Logical -ValueType Element) -eq $value | Should -Be $true + ($ishFields | Set-IshMetadataFilterField -Name "FTITLE" -Level Logical -ValueType Element -value $value | Get-IshMetadataField -Name "FTITLE" -Level Logical -ValueType Element) -eq $value | Should-Be $true } It "Pipeline IshFields Multiple with implicit IshSession extra filter criteria are added" { $value = "OrginalString" $ishFieldA =Set-IshMetadataFilterField -Name "FTITLE" -Level Logical -ValueType Element -value $value $ishFieldB =Set-IshMetadataFilterField -Name "FTITLE" -Level Logical -ValueType Element -value $value $value = "SingleString" - (@($ishFieldA,$ishFieldB) | Set-IshMetadataFilterField -Name "FTITLE" -Level Logical -ValueType Element -value $value).Length | Should -Be 3 + (@($ishFieldA,$ishFieldB) | Set-IshMetadataFilterField -Name "FTITLE" -Level Logical -ValueType Element -value $value).Length | Should-Be 3 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Field/SetIshRequestedMetadataField.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Field/SetIshRequestedMetadataField.Tests.ps1 index 8f068b8..3cf19c0 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Field/SetIshRequestedMetadataField.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Field/SetIshRequestedMetadataField.Tests.ps1 @@ -9,55 +9,55 @@ BeforeAll { Describe "Set-IshRequestedMetadataField" -Tags "Read" { Context "Set-IshRequestedMetadataField -IshSession ishSession returns IshRequestedMetadataField" { It "GetType().Name" { - (Set-IshRequestedMetadataField -IshSession $ishSession -Name "FTITLE").GetType().Name | Should -BeExactly "IshRequestedMetadataField" + (Set-IshRequestedMetadataField -IshSession $ishSession -Name "FTITLE").GetType().Name | Should-BeString -CaseSensitive "IshRequestedMetadataField" } } Context "Set-IshRequestedMetadataField" { It "Parameter IshSession/Name/Level invalid" { - { Set-IshRequestedMetadataField -IshSession "INVALIDISHSESSION" -Name "INVALIDFIELDNAME" -Level "INVALIDFIELDLEVEL" } | Should -Throw + { Set-IshRequestedMetadataField -IshSession "INVALIDISHSESSION" -Name "INVALIDFIELDNAME" -Level "INVALIDFIELDLEVEL" } | Should-Throw } It "Parameter ValueType invalid" { - { Set-IshRequestedMetadataField -IshSession $ishSession -Name "INVALIDFIELDNAME" -Level "INVALIDFIELDLEVEL" -ValueType "INVALIDFIELDVALUETYPE" } | Should -Throw + { Set-IshRequestedMetadataField -IshSession $ishSession -Name "INVALIDFIELDNAME" -Level "INVALIDFIELDLEVEL" -ValueType "INVALIDFIELDVALUETYPE" } | Should-Throw } It "Parameter Name" { - (Set-IshRequestedMetadataField -IshSession $ishSession -Name "FTITLE").Length | Should -Be 1 + (Set-IshRequestedMetadataField -IshSession $ishSession -Name "FTITLE").Length | Should-Be 1 } It "Parameter Name Level" { - (Set-IshRequestedMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical).Length | Should -Be 1 + (Set-IshRequestedMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical).Length | Should-Be 1 } It "Parameter Name Level ValueType" { - (Set-IshRequestedMetadataField -IshSession $ishSession -Name "FAUTHOR" -Level Lng -ValueType Element).Length | Should -Be 1 + (Set-IshRequestedMetadataField -IshSession $ishSession -Name "FAUTHOR" -Level Lng -ValueType Element).Length | Should-Be 1 } It "Parameter Name Level ValueType Overwrite" { (Set-IshRequestedMetadataField -IshSession $ishSession -Name "FAUTHOR" -Level Lng -ValueType Element | - Set-IshRequestedMetadataField -IshSession $ishSession -Name "FAUTHOR" -Level Lng -ValueType Element).Length | Should -Be 1 + Set-IshRequestedMetadataField -IshSession $ishSession -Name "FAUTHOR" -Level Lng -ValueType Element).Length | Should-Be 1 } It "Parameter Name Level ValueType Twice" { (Set-IshRequestedMetadataField -IshSession $ishSession -Name "FAUTHOR" -Level Lng -ValueType Value | Set-IshRequestedMetadataField -IshSession $ishSession -Name "FAUTHOR" -Level Lng -ValueType Id | - Set-IshRequestedMetadataField -IshSession $ishSession -Name "FAUTHOR" -Level Lng -ValueType Element).Length | Should -Be 3 + Set-IshRequestedMetadataField -IshSession $ishSession -Name "FAUTHOR" -Level Lng -ValueType Element).Length | Should-Be 3 } It "Parameter IshFields Single Add" { $ishFields = $null - (Set-IshRequestedMetadataField -IshSession $ishSession -IshField $ishFields -Name "FAUTHOR" -Level Lng -ValueType Element).Length | Should -Be 1 + (Set-IshRequestedMetadataField -IshSession $ishSession -IshField $ishFields -Name "FAUTHOR" -Level Lng -ValueType Element).Length | Should-Be 1 } It "Parameter IshFields Single Update" { $ishFields = Set-IshRequestedMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element - (Set-IshRequestedMetadataField -IshSession $ishSession -IshField $ishFields -Name "FTITLE" -Level Logical -ValueType Element).Length | Should -Be 1 + (Set-IshRequestedMetadataField -IshSession $ishSession -IshField $ishFields -Name "FTITLE" -Level Logical -ValueType Element).Length | Should-Be 1 } It "Parameter IshFields Multiple duplicate entries will be removed" { $ishFieldA =Set-IshRequestedMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element $ishFieldB =Set-IshRequestedMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -ValueType Element - (Set-IshRequestedMetadataField -IshSession $ishSession -IshField @($ishFieldA,$ishFieldB) -Name "FTITLE" -Level Logical -ValueType Element).Length | Should -Be 1 + (Set-IshRequestedMetadataField -IshSession $ishSession -IshField @($ishFieldA,$ishFieldB) -Name "FTITLE" -Level Logical -ValueType Element).Length | Should-Be 1 } It "Pipeline IshFields Single with implicit IshSession" { $ishFields = $null - ($ishFields | Set-IshRequestedMetadataField -Name "FTITLE" -Level Logical -ValueType Element).Length | Should -Be 1 + ($ishFields | Set-IshRequestedMetadataField -Name "FTITLE" -Level Logical -ValueType Element).Length | Should-Be 1 } It "Pipeline IshFields Multiple with implicit IshSession duplicate entries will be removed" { $ishFieldA =Set-IshRequestedMetadataField -Name "FTITLE" -Level Logical -ValueType Element $ishFieldB =Set-IshRequestedMetadataField -Name "FTITLE" -Level Logical -ValueType Element - (@($ishFieldA,$ishFieldB) | Set-IshRequestedMetadataField -Name "FTITLE" -Level Logical -ValueType Element).Length | Should -Be 1 + (@($ishFieldA,$ishFieldB) | Set-IshRequestedMetadataField -Name "FTITLE" -Level Logical -ValueType Element).Length | Should-Be 1 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/FileProcessor/NewIshDitaGeneralizedXml.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/FileProcessor/NewIshDitaGeneralizedXml.Tests.ps1 index 31be5f0..246ba0e 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/FileProcessor/NewIshDitaGeneralizedXml.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/FileProcessor/NewIshDitaGeneralizedXml.Tests.ps1 @@ -69,10 +69,10 @@ Describe "New-IshDitaGeneralizedXml" -Tags "Read" { -FilePath $taskFilePath } It "GetType().Name" { - $taskFileInfo.GetType().Name | Should -BeExactly "FileInfo" + $taskFileInfo.GetType().Name | Should-BeString -CaseSensitive "FileInfo" } It "Task Result String Comparison" { - (Get-Content -Path $taskFileInfo -Raw) -eq $ditaGeneralizedTaskFileContent | Should -Be $True + (Get-Content -Path $taskFileInfo -Raw) -eq $ditaGeneralizedTaskFileContent | Should-Be $True } It "BookMap without Attributes options Result String Comparison" { $bookMapFileInfo = Get-Item $bookMapFilePath | @@ -80,7 +80,7 @@ Describe "New-IshDitaGeneralizedXml" -Tags "Read" { -GeneralizedCatalogFilePath $generalizedCatalogFilePath ` -GeneralizationCatalogMappingFilePath $generalizationCatalogMappingFilePath ` -FolderPath $outputFolder - (Get-Content -Path $bookMapFileInfo -Raw) -eq $ditaGeneralizedBookMapFileContent | Should -Be $True + (Get-Content -Path $bookMapFileInfo -Raw) -eq $ditaGeneralizedBookMapFileContent | Should-Be $True } It "Parameter SpecializedCatalogFilePath invalid" { { @@ -91,7 +91,7 @@ Describe "New-IshDitaGeneralizedXml" -Tags "Read" { -AttributesToGeneralizeToBase $attributesToGeneralizeToBase ` -FolderPath $outputFolder ` -FilePath $taskFilePath - } | Should -Throw + } | Should-Throw } It "Parameter GeneralizedCatalogFilePath invalid" { { @@ -102,7 +102,7 @@ Describe "New-IshDitaGeneralizedXml" -Tags "Read" { -AttributesToGeneralizeToBase $attributesToGeneralizeToBase ` -FolderPath $outputFolder ` -FilePath $taskFilePath - } | Should -Throw + } | Should-Throw } It "Parameter GeneralizationCatalogMappingFilePath invalid" { { @@ -113,7 +113,7 @@ Describe "New-IshDitaGeneralizedXml" -Tags "Read" { -AttributesToGeneralizeToBase $attributesToGeneralizeToBase ` -FolderPath $outputFolder ` -FilePath $taskFilePath - } | Should -Throw + } | Should-Throw } It "Parameter FilePath invalid will result in warning" { { @@ -134,7 +134,7 @@ Describe "New-IshDitaGeneralizedXml" -Tags "Read" { -AttributesToGeneralizeToBase $attributesToGeneralizeToBase ` -FolderPath $outputFolder ` -FilePath $taskFilePath - $fileInfoArray.Count | Should -Be 1 + $fileInfoArray.Count | Should-Be 1 } It "Parameter FilePath Multiple" { $fileInfoArray = New-IshDitaGeneralizedXml -SpecializedCatalogFilePath $specializedCatalogFilePath ` @@ -144,7 +144,7 @@ Describe "New-IshDitaGeneralizedXml" -Tags "Read" { -AttributesToGeneralizeToBase $attributesToGeneralizeToBase ` -FolderPath $outputFolder ` -FilePath @($taskFilePath,$bookMapFilePath) - $fileInfoArray.Count | Should -Be 2 + $fileInfoArray.Count | Should-Be 2 } It "Pipeline FilePath Single" { $fileInfos = Get-Item -Path $taskFilePath @@ -153,7 +153,7 @@ Describe "New-IshDitaGeneralizedXml" -Tags "Read" { -GeneralizationCatalogMappingFilePath $generalizationCatalogMappingFilePath ` -AttributesToGeneralizeToProps $attributesToGeneralizeToProps ` -AttributesToGeneralizeToBase $attributesToGeneralizeToBase ` - -FolderPath $outputFolder).Count | Should -Be 1 + -FolderPath $outputFolder).Count | Should-Be 1 } It "Pipeline FilePath Multiple" { $fileInfos = @((Get-Item -Path $taskFilePath), (Get-Item -Path $bookMapFilePath)) @@ -162,7 +162,7 @@ Describe "New-IshDitaGeneralizedXml" -Tags "Read" { -GeneralizationCatalogMappingFilePath $generalizationCatalogMappingFilePath ` -AttributesToGeneralizeToProps $attributesToGeneralizeToProps ` -AttributesToGeneralizeToBase $attributesToGeneralizeToBase ` - -FolderPath $outputFolder).Count | Should -Be 2 + -FolderPath $outputFolder).Count | Should-Be 2 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/FileProcessor/NewIshObfuscatedFile.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/FileProcessor/NewIshObfuscatedFile.Tests.ps1 index d37091d..4396f6b 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/FileProcessor/NewIshObfuscatedFile.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/FileProcessor/NewIshObfuscatedFile.Tests.ps1 @@ -64,26 +64,26 @@ Describe "New-IshObfuscatedFile" -Tags "Read" { -FilePath $taskFilePath } It "GetType().Name" { - $taskFileInfo.GetType().Name | Should -BeExactly "FileInfo" + $taskFileInfo.GetType().Name | Should-BeString -CaseSensitive "FileInfo" } It "OutputFilePath" { - ($taskFileInfo.FullName -eq (Join-Path -Path $outputFolder -ChildPath "task==1=en.xml")) | Should -Be $True + ($taskFileInfo.FullName -eq (Join-Path -Path $outputFolder -ChildPath "task==1=en.xml")) | Should-Be $True } It "Task Result String Comparison" { - (Get-Content -Path $taskFileInfo -Raw) -eq $ditaObfuscatedTaskFileContent | Should -Be $True + (Get-Content -Path $taskFileInfo -Raw) -eq $ditaObfuscatedTaskFileContent | Should-Be $True } It "BookMap Result String Comparison without XmlAttributesToObfuscate @navtitle" { $bookMapFileInfo = New-IshObfuscatedFile -FolderPath $outputFolder -FilePath $bookMapFilePath - (Get-Content -Path $bookMapFileInfo -Raw) -eq $ditaObfuscatedBookMapWithoutNavtitleFileContent | Should -Be $True + (Get-Content -Path $bookMapFileInfo -Raw) -eq $ditaObfuscatedBookMapWithoutNavtitleFileContent | Should-Be $True } It "BookMap Result String Comparison with XmlAttributesToObfuscate @navtitle" { $bookMapFileInfo = New-IshObfuscatedFile -FolderPath $outputFolder -FilePath $bookMapFilePath -XmlAttributesToObfuscate @("navtitle") - (Get-Content -Path $bookMapFileInfo -Raw) -eq $ditaObfuscatedBookMapWithNavtitleFileContent | Should -Be $True + (Get-Content -Path $bookMapFileInfo -Raw) -eq $ditaObfuscatedBookMapWithNavtitleFileContent | Should-Be $True } It "Image Result Comparison" { $imageFilePath = New-IshObfuscatedFile -FolderPath $outputFolder ` -FilePath $imageFilePath - $imageFilePath.Count -gt 0 | Should -Be $True + $imageFilePath.Count -gt 0 | Should-Be $True } It "Parameter XmlFileExtensions invalid" { { @@ -97,19 +97,19 @@ Describe "New-IshObfuscatedFile" -Tags "Read" { } It "Parameter FilePath Single" { $fileInfoArray =New-IshObfuscatedFile -FolderPath $outputFolder -FilePath $taskFilePath - $fileInfoArray.Count | Should -Be 1 + $fileInfoArray.Count | Should-Be 1 } It "Parameter FilePath Multiple" { $fileInfoArray = New-IshObfuscatedFile -FolderPath $outputFolder -FilePath @($taskFilePath,$bookMapFilePath) - $fileInfoArray.Count | Should -Be 2 + $fileInfoArray.Count | Should-Be 2 } It "Pipeline FilePath Single" { $fileInfos = Get-Item -Path $taskFilePath - ($fileInfos | New-IshObfuscatedFile -FolderPath $outputFolder).Count | Should -Be 1 + ($fileInfos | New-IshObfuscatedFile -FolderPath $outputFolder).Count | Should-Be 1 } It "Pipeline FilePath Multiple" { $fileInfos = @((Get-Item -Path $taskFilePath), (Get-Item -Path $bookMapFilePath)) - ($fileInfos | New-IshObfuscatedFile -FolderPath $outputFolder).Count | Should -Be 2 + ($fileInfos | New-IshObfuscatedFile -FolderPath $outputFolder).Count | Should-Be 2 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/FileProcessor/TestIshValidXml.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/FileProcessor/TestIshValidXml.Tests.ps1 index 411d770..521455e 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/FileProcessor/TestIshValidXml.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/FileProcessor/TestIshValidXml.Tests.ps1 @@ -60,39 +60,39 @@ Describe "Test-IshValidXml" -Tags "Read" { Context "Test-IshValidXml" { It "GetType().Name" { $result = Test-IshValidXml -XmlCatalogFilePath $catalogFilePath -FilePath $task1FilePath - $result.GetType().Name | Should -BeExactly "Boolean" + $result.GetType().Name | Should-BeString -CaseSensitive "Boolean" } It "Parameter XmlCatalogFilePath invalid" { { Test-IshValidXml -XmlCatalogFilePath "INVALID" -FilePath $task1FilePath - } | Should -Throw + } | Should-Throw } It "Parameter FilePath invalid" { - Test-IshValidXml -XmlCatalogFilePath $catalogFilePath -FilePath "INVALID" | Should -Be $False + Test-IshValidXml -XmlCatalogFilePath $catalogFilePath -FilePath "INVALID" | Should-Be $False } It "Parameter FilePath Single" { $resultArray = Test-IshValidXml -XmlCatalogFilePath $catalogFilePath -FilePath $task1FilePath - $resultArray.Count | Should -Be 1 - $resultArray[0] | Should -Be $True + $resultArray.Count | Should-Be 1 + $resultArray[0] | Should-Be $True } It "Parameter FilePath Multiple" { $resultArray = Test-IshValidXml -XmlCatalogFilePath $catalogFilePath -FilePath @($task1FilePath,$task2FilePath) - $resultArray.Count | Should -Be 2 - $resultArray[0] | Should -Be $True - $resultArray[1] | Should -Be $False + $resultArray.Count | Should-Be 2 + $resultArray[0] | Should-Be $True + $resultArray[1] | Should-Be $False } It "Pipeline FilePath Single" { $fileInfoArray = Get-Item -Path $task2FilePath $resultArray = $fileInfoArray | Test-IshValidXml -XmlCatalogFilePath $catalogFilePath - $resultArray.Count | Should -Be 1 - $resultArray[0] | Should -Be $False + $resultArray.Count | Should-Be 1 + $resultArray[0] | Should-Be $False } It "Pipeline FilePath Multiple" { $fileInfoArray = @((Get-Item -Path $bookMap2FilePath), (Get-Item -Path $bookMap3FilePath)) $resultArray = $fileInfoArray | Test-IshValidXml -XmlCatalogFilePath $catalogFilePath - $resultArray.Count | Should -Be 2 - $resultArray[0] | Should -Be $False - $resultArray[1] | Should -Be $False + $resultArray.Count | Should-Be 2 + $resultArray[0] | Should-Be $False + $resultArray[1] | Should-Be $False } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/AddIshFolder.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/AddIshFolder.Tests.ps1 index e5f8c17..17a6e8b 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/AddIshFolder.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/AddIshFolder.Tests.ps1 @@ -22,69 +22,69 @@ Describe "Add-IshFolder" -Tags "Create" { } Context "Add-IshFolder ParameterGroup" { It "Parameter IshSession invalid" { - { Add-IshFolder -IShSession "INVALIDISHSESSION" -ParentFolderId "-6" -FolderType ISHNone -FolderName "INVALIDFOLDERNAME" -OwnedBy "INVALIDUSERGROUP" -ReadAccess @("INVALIDUSERGROUPA","INVALIDUSERGROUPB") } | Should -Throw + { Add-IshFolder -IShSession "INVALIDISHSESSION" -ParentFolderId "-6" -FolderType ISHNone -FolderName "INVALIDFOLDERNAME" -OwnedBy "INVALIDUSERGROUP" -ReadAccess @("INVALIDUSERGROUPA","INVALIDUSERGROUPB") } | Should-Throw } } Context "Add-IshFolder returns IshFolder object" { It "GetType().Name" { - $ishFolderCmdlet.GetType().Name | Should -BeExactly "IshFolder" + $ishFolderCmdlet.GetType().Name | Should-BeString -CaseSensitive "IshFolder" } It "ishFolderCmdlet.IshFolderRef" { - $ishFolderCmdlet.IshFolderRef -ge 0 | Should -Be $true + $ishFolderCmdlet.IshFolderRef -ge 0 | Should-Be $true } It "ishFolderCmdlet.IshFolderType" { - $ishFolderCmdlet.IshFolderType | Should -Not -BeNullOrEmpty + $ishFolderCmdlet.IshFolderType | Should-NotBeNull } It "ishFolderCmdlet.IshField" { - $ishFolderCmdlet.IshField | Should -Not -BeNullOrEmpty + $ishFolderCmdlet.IshField | Should-NotBeNull } It "Option IshSession.DefaultRequestedMetadata" { - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" - $ishFolderCmdlet.name.Length -ge 1 | Should -Be $true - $ishFolderCmdlet.fdocumenttype.Length -ge 1 | Should -Be $true - $ishFolderCmdlet.fdocumenttype_none_element.StartsWith('VDOCTYPE') | Should -Be $true + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" + $ishFolderCmdlet.name.Length -ge 1 | Should-Be $true + $ishFolderCmdlet.fdocumenttype.Length -ge 1 | Should-Be $true + $ishFolderCmdlet.fdocumenttype_none_element.StartsWith('VDOCTYPE') | Should-Be $true } } Context "Add-IshFolder ParameterGroup" { It "Parameter ParentFolderId invalid" { - { Add-IshFolder -IShSession $ishSession -ParentFolderId "INVALIDFOLDERID" } | Should -Throw + { Add-IshFolder -IShSession $ishSession -ParentFolderId "INVALIDFOLDERID" } | Should-Throw } It "Parameter ParentFolderId invalid" { - { Add-IshFolder -IShSession $ishSession -ParentFolderId "INVALIDFOLDERID" } | Should -Throw + { Add-IshFolder -IShSession $ishSession -ParentFolderId "INVALIDFOLDERID" } | Should-Throw } It "Parameter FolderType ISHIllustration" { $ishFolders = Add-IshFolder -IshSession $ishSession -ParentFolderId ($ishFolderCmdlet.IshFolderRef) -FolderType ISHIllustration -FolderName "ParameterGroup ISHIllustration" -OwnedBy $ownedByTestRootOriginal -ReadAccess $readAccessTestRootOriginal - $ishFolders.Count | Should -Be 1 + $ishFolders.Count | Should-Be 1 } It "Parameter FolderType ISHLibrary" { $ishFolders = Add-IshFolder -IshSession $ishSession -ParentFolderId ($ishFolderCmdlet.IshFolderRef) -FolderType ISHLibrary -FolderName "ParameterGroup ISHLibrary" -OwnedBy $ownedByTestRootOriginal -ReadAccess $readAccessTestRootOriginal - $ishFolders.Count | Should -Be 1 + $ishFolders.Count | Should-Be 1 } It "Parameter FolderType ISHMasterDoc" { $ishFolders = Add-IshFolder -IshSession $ishSession -ParentFolderId ($ishFolderCmdlet.IshFolderRef) -FolderType ISHMasterDoc -FolderName "ParameterGroup ISHMasterDoc" -OwnedBy $ownedByTestRootOriginal -ReadAccess $readAccessTestRootOriginal - $ishFolders.Count | Should -Be 1 + $ishFolders.Count | Should-Be 1 } It "Parameter FolderType ISHModule" { $ishFolders = Add-IshFolder -IshSession $ishSession -ParentFolderId ($ishFolderCmdlet.IshFolderRef) -FolderType ISHModule -FolderName "ParameterGroup ISHModule" -OwnedBy $ownedByTestRootOriginal -ReadAccess $readAccessTestRootOriginal - $ishFolders.Count | Should -Be 1 + $ishFolders.Count | Should-Be 1 } It "Parameter FolderType ISHNone" { $ishFolders = Add-IshFolder -IshSession $ishSession -ParentFolderId ($ishFolderCmdlet.IshFolderRef) -FolderType ISHNone -FolderName "ParameterGroup ISHNone" -OwnedBy $ownedByTestRootOriginal -ReadAccess $readAccessTestRootOriginal - $ishFolders.Count | Should -Be 1 + $ishFolders.Count | Should-Be 1 } It "Parameter FolderType ISHPublication" { $ishFolders = Add-IshFolder -IshSession $ishSession -ParentFolderId ($ishFolderCmdlet.IshFolderRef) -FolderType ISHPublication -FolderName "ParameterGroup ISHPublication" -OwnedBy $ownedByTestRootOriginal -ReadAccess $readAccessTestRootOriginal - $ishFolders.Count | Should -Be 1 + $ishFolders.Count | Should-Be 1 } It "Parameter FolderType ISHTemplate" { $ishFolders = Add-IshFolder -IshSession $ishSession -ParentFolderId ($ishFolderCmdlet.IshFolderRef) -FolderType ISHTemplate -FolderName "ParameterGroup ISHTemplate" -OwnedBy $ownedByTestRootOriginal -ReadAccess $readAccessTestRootOriginal - $ishFolders.Count | Should -Be 1 + $ishFolders.Count | Should-Be 1 } It "Parameter FolderType ISHQuery" { - { Add-IshFolder -IshSession $ishSession -ParentFolderId ($ishFolderCmdlet.IshFolderRef) -FolderType ISHQuery -FolderName "ParameterGroup ISHQuery" -OwnedBy $ownedByTestRootOriginal -ReadAccess $readAccessTestRootOriginal } | Should -Throw + { Add-IshFolder -IshSession $ishSession -ParentFolderId ($ishFolderCmdlet.IshFolderRef) -FolderType ISHQuery -FolderName "ParameterGroup ISHQuery" -OwnedBy $ownedByTestRootOriginal -ReadAccess $readAccessTestRootOriginal } | Should-Throw } It "Parameter FolderType ISHReference" { - { Add-IshFolder -IshSession $ishSession -ParentFolderId ($ishFolderCmdlet.IshFolderRef) -FolderType ISHReference -FolderName "ParameterGroup ISHReference" -OwnedBy $ownedByTestRootOriginal -ReadAccess $readAccessTestRootOriginal } | Should -Throw + { Add-IshFolder -IshSession $ishSession -ParentFolderId ($ishFolderCmdlet.IshFolderRef) -FolderType ISHReference -FolderName "ParameterGroup ISHReference" -OwnedBy $ownedByTestRootOriginal -ReadAccess $readAccessTestRootOriginal } | Should-Throw } } @@ -97,29 +97,29 @@ Describe "Add-IshFolder" -Tags "Create" { $ishFolderEditorTemplate = Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate } It "Parameter IshFolder invalid" { - { Add-IshFolder -IShSession $ishSession -IshFolder "INVALIDFOLDERID" } | Should -Throw + { Add-IshFolder -IShSession $ishSession -IshFolder "INVALIDFOLDERID" } | Should-Throw } It "Parameter IshFolder Single with implicit IshSession" { $ishFolderEditorTemplate = $ishFolderEditorTemplate | Set-IshMetadataField -Name "FNAME" -Level None -Value "EditorTemplate IshFoldersGroup Parameter IshFolder Single" $ishFolders = Add-IshFolder -IshFolder $ishFolderEditorTemplate -ParentFolderId $ishFolderCmdlet.IshFolderRef - $ishFolders.Count | Should -Be 1 + $ishFolders.Count | Should-Be 1 } It "Parameter IshFolder Multiple with implicit IshSession" { $ishFolderEditorTemplate = $ishFolderEditorTemplate | Set-IshMetadataField -Name "FNAME" -Level None -Value "EditorTemplate IshFoldersGroup Parameter IshFolder Multiple" $ishFolderFavorites = $ishFolderFavorites | Set-IshMetadataField -Name "FNAME" -Level None -Value "Favorites IshFoldersGroup Parameter IshFolder Multiple" $ishFolders = Add-IshFolder -IshFolder @($ishFolderEditorTemplate,$ishFolderFavorites) -ParentFolderId $ishFolderCmdlet.IshFolderRef - $ishFolders.Count | Should -Be 2 + $ishFolders.Count | Should-Be 2 } It "Pipeline IshFolder Single" { $ishFolderData = $ishFolderData | Set-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -Value "EditorTemplate IshFoldersGroup Pipeline IshFolder Single" $ishFolders = $ishFolderData | Add-IshFolder -IshSession $ishSession -ParentFolderId $ishFolderCmdlet.IshFolderRef - $ishFolders.Count | Should -Be 1 + $ishFolders.Count | Should-Be 1 } It "Pipeline IshFolder Multiple" { $ishFolderData = $ishFolderData | Set-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -Value "EditorTemplate IshFoldersGroup Pipeline IshFolder Multiple" $ishFolderSystem = $ishFolderSystem | Set-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -Value "System IshFoldersGroup Pipeline IshFolder Multiple" $ishFolders = @($ishFolderData,$ishFolderSystem) | Add-IshFolder -IshSession $ishSession -ParentFolderId $ishFolderCmdlet.IshFolderRef - $ishFolders.Count | Should -Be 2 + $ishFolders.Count | Should-Be 2 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/GetIshFolder.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/GetIshFolder.Tests.ps1 index e5d0b77..9403460 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/GetIshFolder.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/GetIshFolder.Tests.ps1 @@ -31,55 +31,55 @@ Describe "Get-IshFolder" -Tags "Read" { } Context "Get-IshFolder ParameterGroup" { It "Parameter IshSession invalid" { - { Get-IshFolder -IShSession "INVALIDISHSESSION" } | Should -Throw + { Get-IshFolder -IShSession "INVALIDISHSESSION" } | Should-Throw } } Context "Get-IshFolder returns IshFolder object" { It "GetType()" { - $ishFolderData.GetType().Name | Should -BeExactly "IshFolder" + $ishFolderData.GetType().Name | Should-BeString -CaseSensitive "IshFolder" } It "ishFolderData.IshFolderRef" { - $ishFolderData.IshFolderRef -ge 0 | Should -Be $true + $ishFolderData.IshFolderRef -ge 0 | Should-Be $true } It "ishFolderData.IshFolderType" { - $ishFolderData.IshFolderType | Should -Not -BeNullOrEmpty + $ishFolderData.IshFolderType | Should-NotBeNull } It "ishFolderData.IshField" { - $ishFolderData.IshField | Should -Not -BeNullOrEmpty + $ishFolderData.IshField | Should-NotBeNull } It "Option IshSession.DefaultRequestedMetadata" { - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" - $ishFolderData.name.Length -ge 1 | Should -Be $true - $ishFolderData.fdocumenttype.Length -ge 1 | Should -Be $true - $ishFolderData.fdocumenttype_none_element.StartsWith('VDOCTYPE') | Should -Be $true + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" + $ishFolderData.name.Length -ge 1 | Should-Be $true + $ishFolderData.fdocumenttype.Length -ge 1 | Should-Be $true + $ishFolderData.fdocumenttype_none_element.StartsWith('VDOCTYPE') | Should-Be $true } } Context "Get-IshFolder BaseFolderGroup" { It "Parameter BaseFolder invalid" { - { Get-IshFolder -IShSession $ishSession -BaseFolder None } | Should -Throw + { Get-IshFolder -IShSession $ishSession -BaseFolder None } | Should-Throw } It "Parameter BaseFolder Data" { - (Get-IshFolder -IShSession $ishSession -BaseFolder Data).IshFolderRef -ge 0 | Should -Be $true + (Get-IshFolder -IShSession $ishSession -BaseFolder Data).IshFolderRef -ge 0 | Should-Be $true } It "Parameter BaseFolder System" { - (Get-IshFolder -IShSession $ishSession -BaseFolder System).IshFolderRef -ge 0 | Should -Be $true + (Get-IshFolder -IShSession $ishSession -BaseFolder System).IshFolderRef -ge 0 | Should-Be $true } It "Parameter BaseFolder Favorites" { - (Get-IshFolder -IShSession $ishSession -BaseFolder Favorites).IshFolderRef -ge 0 | Should -Be $true + (Get-IshFolder -IShSession $ishSession -BaseFolder Favorites).IshFolderRef -ge 0 | Should-Be $true } It "Parameter BaseFolder EditorTemplate" { - (Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate).IshFolderRef -ge 0 | Should -Be $true + (Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate).IshFolderRef -ge 0 | Should-Be $true } } Context "Get-IshFolder FolderPathGroup" { It "Parameter FolderPath invalid" { - $exception = { Get-IshFolder -IShSession $ishSession -FolderPath "INVALIDFOLDERPATH" } | Should -Throw -PassThru + $exception = { Get-IshFolder -IShSession $ishSession -FolderPath "INVALIDFOLDERPATH" } | Should-Throw # 14.0.4 message is: [-102001] The folder 'INVALIDFOLDERPATH' does not exist. [name:"'INVALIDFOLDERPATH'"] [102001;InvalidObject] - $exception -like "*102001*" | Should -Be $true - $exception -like "*InvalidObject*" | Should -Be $true + $exception -like "*102001*" | Should-Be $true + $exception -like "*InvalidObject*" | Should-Be $true } It "Parameter FolderPath $folderTestRootPath" { - (Get-IshFolder -IshSession $ishSession -FolderPath $folderTestRootPath).IshFolderRef -ge 0 | Should -Be $true + (Get-IshFolder -IshSession $ishSession -FolderPath $folderTestRootPath).IshFolderRef -ge 0 | Should-Be $true } } Context "Get-IshFolder FolderIdsGroup" { @@ -90,27 +90,27 @@ Describe "Get-IshFolder" -Tags "Read" { [long]$ishFolderEditorTemplateFolderRef = (Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate).IshFolderRef } It "Parameter FolderId invalid" { - { Get-IshFolder -IShSession $ishSession -FolderId "INVALIDFOLDERID" } | Should -Throw + { Get-IshFolder -IShSession $ishSession -FolderId "INVALIDFOLDERID" } | Should-Throw } It "Parameter FolderId zero" { - { Get-IshFolder -IShSession $ishSession -FolderId 0 } | Should -Throw + { Get-IshFolder -IShSession $ishSession -FolderId 0 } | Should-Throw } It "Parameter FolderId from Data" { - (Get-IshFolder -IshSession $ishSession -FolderId $ishFolderDataFolderRef).IshFolderRef -ge 0 | Should -Be $true + (Get-IshFolder -IshSession $ishSession -FolderId $ishFolderDataFolderRef).IshFolderRef -ge 0 | Should-Be $true } <# FolderId is defined as long, not long[], so don't even know if PowerShell automatically converts It "Parameter FolderId from Data.System" { - (Get-IshFolder -IshSession $ishSession -FolderId [long[]]@($ishFolderDataFolderRef,$ishFolderSystemFolderRef)).Count -eq 2 | Should -Be $true + (Get-IshFolder -IshSession $ishSession -FolderId [long[]]@($ishFolderDataFolderRef,$ishFolderSystemFolderRef)).Count -eq 2 | Should-Be $true } #> It "Pipeline FolderId" { $ishFolders = @($ishFolderDataFolderRef,$ishFolderSystemFolderRef,$ishFolderFavoritesFolderRef,$ishFolderEditorTemplateFolderRef) | Get-IshFolder -IshSession $ishSession - $ishFolders.Count -eq 4 | Should -Be $true + $ishFolders.Count -eq 4 | Should-Be $true } It "Pipeline FolderId MetadataBatchSize[1]" { $ishSession.MetadataBatchSize = 1 $ishFolders = @($ishFolderDataFolderRef,$ishFolderSystemFolderRef,$ishFolderFavoritesFolderRef,$ishFolderEditorTemplateFolderRef) | Get-IshFolder -IshSession $ishSession - $ishFolders.Count -eq 4 | Should -Be $true + $ishFolders.Count -eq 4 | Should-Be $true } } Context "Get-IshFolder IshFoldersGroup" { @@ -121,22 +121,22 @@ Describe "Get-IshFolder" -Tags "Read" { $ishFolderEditorTemplate = Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate } It "Parameter IshFolder invalid" { - { Get-IshFolder -IShSession $ishSession -IshFolder "INVALIDFOLDERID" } | Should -Throw + { Get-IshFolder -IShSession $ishSession -IshFolder "INVALIDFOLDERID" } | Should-Throw } It "Parameter IshFolder Single with implicit IshSession" { - (Get-IshFolder -IshFolder $ishFolderData).IshFolderRef -ge 0 | Should -Be $true + (Get-IshFolder -IshFolder $ishFolderData).IshFolderRef -ge 0 | Should-Be $true } It "Parameter IshFolder Multiple with implicit IshSession" { - (Get-IshFolder -IshFolder @($ishFolderData,$ishFolderSystem,$ishFolderFavorites,$ishFolderEditorTemplate)).Count -eq 4 | Should -Be $true + (Get-IshFolder -IshFolder @($ishFolderData,$ishFolderSystem,$ishFolderFavorites,$ishFolderEditorTemplate)).Count -eq 4 | Should-Be $true } It "Pipeline IshFolder Single" { $ishFolders = $ishFolderData | Get-IshFolder -IshSession $ishSession - $ishFolders.Count -eq 1 | Should -Be $true + $ishFolders.Count -eq 1 | Should-Be $true } It "Pipeline IshFolder Multiple" { $ishSession.MetadataBatchSize = 2 $ishFolders = @($ishFolderData,$ishFolderSystem,$ishFolderFavorites,$ishFolderEditorTemplate) | Get-IshFolder -IshSession $ishSession - $ishFolders.Count -eq 4 | Should -Be $true + $ishFolders.Count -eq 4 | Should-Be $true } } Context "Get-IshFolder EditorTemplate Recurse" { @@ -144,22 +144,22 @@ Describe "Get-IshFolder" -Tags "Read" { $ishFolderEditorTemplateRecursive = Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate -Recurse } It "GetType()" { - $ishFolderEditorTemplateRecursive[0].GetType().Name | Should -BeExactly "IshFolder" + $ishFolderEditorTemplateRecursive[0].GetType().Name | Should-BeString -CaseSensitive "IshFolder" } It "Get-IshFolder EditorTemplate Count" { - $ishFolderEditorTemplateRecursive.Count -ge 4 | Should -Be $true + $ishFolderEditorTemplateRecursive.Count -ge 4 | Should-Be $true } It "Get-IshFolder EditorTemplate Count Depth=-1" { - (Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate -Recurse -Depth -1).Count | Should -Be 0 + (Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate -Recurse -Depth -1).Count | Should-Be 0 } It "Get-IshFolder EditorTemplate Count Depth=0" { - (Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate -Recurse -Depth 0).Count | Should -Be 0 + (Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate -Recurse -Depth 0).Count | Should-Be 0 } It "Get-IshFolder EditorTemplate Count Depth=1" { - (Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate -Recurse -Depth 1).Count | Should -Be 1 + (Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate -Recurse -Depth 1).Count | Should-Be 1 } It "Get-IshFolder EditorTemplate Count Depth=2" { - (Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate -Recurse -Depth 2).Count -ge 4 | Should -Be $true + (Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate -Recurse -Depth 2).Count -ge 4 | Should-Be $true } } Context "Get-IshFolder Recurse Sort and Traversal" { @@ -167,84 +167,84 @@ Describe "Get-IshFolder" -Tags "Read" { $ishFolderEditorTemplateRecursive = Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate -Recurse } It "GetType()" { - $ishFolderEditorTemplateRecursive[0].GetType().Name | Should -BeExactly "IshFolder" + $ishFolderEditorTemplateRecursive[0].GetType().Name | Should-BeString -CaseSensitive "IshFolder" } It "Get-IshFolder ishFolderCmdlet Count" { - $ishFolderEditorTemplateRecursive.Count -ge 6 | Should -Be $true + $ishFolderEditorTemplateRecursive.Count -ge 6 | Should-Be $true } It "Get-IshFolder ishFolderCmdlet Count Depth=2" { - (Get-IshFolder -IShSession $ishSession -IshFolder $ishFolderCmdlet -Recurse -Depth 2).Count | Should -Be 3 + (Get-IshFolder -IShSession $ishSession -IshFolder $ishFolderCmdlet -Recurse -Depth 2).Count | Should-Be 3 } It "Get-IshFolder ishFolderCmdlet Traversal 'All'" { - Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -IshField((Get-IshFolder -IShSession $ishSession -IshFolder $ishFolderCmdlet -Recurse)[1].IshField) | Should -MatchExactly "All" + Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -IshField((Get-IshFolder -IShSession $ishSession -IshFolder $ishFolderCmdlet -Recurse)[1].IshField) | Should-MatchString -CaseSensitive "All" } It "Get-IshFolder ishFolderCmdlet Traversal 'aLL'" { - Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -IshField((Get-IshFolder -IShSession $ishSession -IshFolder $ishFolderCmdlet -Recurse)[7].IshField) | Should -MatchExactly "aLL yOUR bASE bELONG tO uS!" + Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -IshField((Get-IshFolder -IShSession $ishSession -IshFolder $ishFolderCmdlet -Recurse)[7].IshField) | Should-MatchString -CaseSensitive "aLL yOUR bASE bELONG tO uS!" } It "Get-IshFolder ishFolderCmdlet Traversal 'All' with FolderTypeFilter" { - Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -IshField((Get-IshFolder -IShSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule", "ISHNone") -Recurse)[1].IshField) | Should -MatchExactly "All" + Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -IshField((Get-IshFolder -IShSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule", "ISHNone") -Recurse)[1].IshField) | Should-MatchString -CaseSensitive "All" } It "Get-IshFolder ishFolderCmdlet Traversal 'aLL' with FolderTypeFilter" { - Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -IshField((Get-IshFolder -IShSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule", "ISHNone") -Recurse)[7].IshField) | Should -MatchExactly "aLL yOUR bASE bELONG tO uS!" + Get-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -IshField((Get-IshFolder -IShSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule", "ISHNone") -Recurse)[7].IshField) | Should-MatchString -CaseSensitive "aLL yOUR bASE bELONG tO uS!" } } Context "Get-IshFolder System Recurse Pipeline" { It "Get-IshFolder System Recurse Pipeline to Get-IshFolderContent" { # Check Fiddler that Folder calls alternate with DocumentObj calls confirming the pipeline $ishObjects = Get-IshFolder -IShSession $ishSession -BaseFolder System -Recurse | Get-IshFolderContent -IshSession $ishSession - $ishObjects.Count -ge 1 | Should -Be $true + $ishObjects.Count -ge 1 | Should-Be $true } } Context "Get-IshFolder with requesting FolderTypeFilter and Recursion" { It "Get-IshFolder with incorrect FolderTypeFilter" { - {Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter "ISHWrongType" -Recurse} | Should -Throw + {Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter "ISHWrongType" -Recurse} | Should-Throw } It "Get-IshFolder with incorrect value in array FolderTypeFilter" { - {Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule", "ISHWrongType") -Recurse} | Should -Throw + {Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule", "ISHWrongType") -Recurse} | Should-Throw } It "Get-IshFolder with empty FolderTypeFilter" { - {Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter "" -Recurse} | Should -Throw + {Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter "" -Recurse} | Should-Throw } It "Get-IshFolder with filtering on all Xml content folders" { - (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule", "ISHMasterDoc", "ISHLibrary", "ISHTemplate") -Recurse).Count | Should -Be 7 + (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule", "ISHMasterDoc", "ISHLibrary", "ISHTemplate") -Recurse).Count | Should-Be 7 } It "Get-IshFolder with filtering on all Xml content folders with Depth=2" { - (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule", "ISHMasterDoc", "ISHLibrary", "ISHTemplate") -Recurse -Depth 2).Count | Should -Be 2 + (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule", "ISHMasterDoc", "ISHLibrary", "ISHTemplate") -Recurse -Depth 2).Count | Should-Be 2 } It "Get-IshFolder with filtering on all folders with Depth=2" { - (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule", "ISHMasterDoc", "ISHLibrary", "ISHTemplate", "ISHNone", "ISHIllustration") -Recurse -Depth 2).Count | Should -Be 3 + (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule", "ISHMasterDoc", "ISHLibrary", "ISHTemplate", "ISHNone", "ISHIllustration") -Recurse -Depth 2).Count | Should-Be 3 } It "Get-IshFolder without filtering on FolderType" { - (Get-IshFolder -IShSession $ishSession -IshFolder $ishFolderCmdlet -Recurse).Count | Should -Be 8 + (Get-IshFolder -IShSession $ishSession -IshFolder $ishFolderCmdlet -Recurse).Count | Should-Be 8 } It "Get-IshFolder with filtering on only ISHModule folders" { - (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule") -Recurse).Count | Should -Be 7 + (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule") -Recurse).Count | Should-Be 7 } It "Get-IshFolder with filtering on only ISHNone folders" { - (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHNone") -Recurse).Count | Should -Be 1 + (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHNone") -Recurse).Count | Should-Be 1 } It "Get-IshFolder with filtering out all folders" { - (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHIllustration") -Recurse).Count | Should -Be 0 + (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHIllustration") -Recurse).Count | Should-Be 0 } } Context "Get-IshFolder with requesting FolderTypeFilter and with no Recursion" { It "Get-IshFolder with incorrect FolderTypeFilter" { - {Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter "ISHWrongType" } | Should -Throw + {Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter "ISHWrongType" } | Should-Throw } It "Get-IshFolder with incorrect value in array FolderTypeFilter" { - {Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule", "ISHWrongType") } | Should -Throw + {Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule", "ISHWrongType") } | Should-Throw } It "Get-IshFolder with empty FolderTypeFilter" { - {Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter "" } | Should -Throw + {Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter "" } | Should-Throw } It "Get-IshFolder with filtering on only ISHNone folders" { - (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHNone")).Count | Should -Be 1 + (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHNone")).Count | Should-Be 1 } It "Get-IshFolder with filtering out all folders" { - (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHIllustration")).Count | Should -Be 0 + (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHIllustration")).Count | Should-Be 0 } It "Get-IshFolder with filtering out all folders(Filter array)" { - (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule", "ISHMasterDoc", "ISHLibrary", "ISHTemplate")).Count | Should -Be 0 + (Get-IshFolder -IshSession $ishSession -IshFolder $ishFolderCmdlet -FolderTypeFilter @("ISHModule", "ISHMasterDoc", "ISHLibrary", "ISHTemplate")).Count | Should-Be 0 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/GetIshFolderContent.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/GetIshFolderContent.Tests.ps1 index e6c22d6..f322ab5 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/GetIshFolderContent.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/GetIshFolderContent.Tests.ps1 @@ -36,7 +36,7 @@ Describe "Get-IshFolderContent" -Tags "Read" { } Context "Get-IshFolderContent ParameterGroup" { It "Parameter IshSession invalid" { - { Get-IshFolderContent -IShSession "INVALIDISHSESSION" } | Should -Throw + { Get-IshFolderContent -IShSession "INVALIDISHSESSION" } | Should-Throw } } Context "Get-IshFolderContent returns latest IshObject[] object" { @@ -45,51 +45,51 @@ Describe "Get-IshFolderContent" -Tags "Read" { $ishObjects = Get-IshFolderContent -IShSession $ishSession -IshFolder $ishFolderTopic -RequestedMetadata $requestedMetadata } It "GetType().Name" { - $ishObjects.GetType().Name | Should -BeExactly "Object[]" + $ishObjects.GetType().Name | Should-BeString -CaseSensitive "Object[]" } It "ishObjects.Count" { - $ishObjects.Length | Should -BeExactly $ishTopicCount + $ishObjects.Length | Should-Be $ishTopicCount } It "[0]GetType().BaseType.Name" { # Used to be IshObject, but more specific ISHType like IshDocumentObj or IshPublicationOutput is put on the pipeline - $ishObjects[0].GetType().Name | Should -BeExactly "IshDocumentObj" + $ishObjects[0].GetType().Name | Should-BeString -CaseSensitive "IshDocumentObj" } It "ishObjects[0].IshData" { { $ishObjects[0].IshData } | Should -Not -Throw } It "ishObjects[0].IshField" { - $ishObjects[0].IshField | Should -Not -BeNullOrEmpty + $ishObjects[0].IshField | Should-NotBeNull } It "ishObjects[0].IshRef" { - $ishObjects[0].IshRef | Should -Not -BeNullOrEmpty + $ishObjects[0].IshRef | Should-NotBeNull } It "ishObjects[0].IshType" { - $ishObjects[0].IshType | Should -Not -BeNullOrEmpty + $ishObjects[0].IshType | Should-NotBeNull } It "ishObjects[0].ObjectRef" { # Double check following 3 ReferenceType enum usage - $ishObjects[0].ObjectRef | Should -Not -BeNullOrEmpty + $ishObjects[0].ObjectRef | Should-NotBeNull } It "ishObjects[0].VersionRef" { - $ishObjects[0].VersionRef | Should -Not -BeNullOrEmpty + $ishObjects[0].VersionRef | Should-NotBeNull } It "ishObjects[0].LngRef" { - $ishObjects[0].LngRef | Should -Not -BeNullOrEmpty + $ishObjects[0].LngRef | Should-NotBeNull } It "ishObjects[0] ConvertTo-Json" { - (ConvertTo-Json $ishObjects[0]).Length -gt 2 | Should -Be $true + (ConvertTo-Json $ishObjects[0]).Length -gt 2 | Should-Be $true } It "Option IshSession.DefaultRequestedMetadata" { - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" #logical - $ishObjects[0].ftitle_logical_value.Length -ge 1 | Should -Be $true + $ishObjects[0].ftitle_logical_value.Length -ge 1 | Should-Be $true #version - $ishObjects[0].version_version_value.Length -ge 1 | Should -Be $true - $ishObjects[0].version_version_value -ge 2 | Should -Be $true + $ishObjects[0].version_version_value.Length -ge 1 | Should-Be $true + $ishObjects[0].version_version_value -ge 2 | Should-Be $true #language - $ishObjects[0].fstatus.Length -ge 1 | Should -Be $true - $ishObjects[0].fstatus_lng_element.StartsWith('VSTATUS') | Should -Be $true - $ishObjects[0].fishstatustype -ge 0 | Should -Be $true + $ishObjects[0].fstatus.Length -ge 1 | Should-Be $true + $ishObjects[0].fstatus_lng_element.StartsWith('VSTATUS') | Should-Be $true + $ishObjects[0].fishstatustype -ge 0 | Should-Be $true } } Context "Get-IshFolderContent with empty VersionFilter returns IshObject[] object" { @@ -98,86 +98,86 @@ Describe "Get-IshFolderContent" -Tags "Read" { $ishObjects = Get-IshFolderContent -IShSession $ishSession -VersionFilter "" -IshFolder $ishFolderTopic -RequestedMetadata $requestedMetadata } It "GetType().Name" { - $ishObjects.GetType().Name | Should -BeExactly "Object[]" + $ishObjects.GetType().Name | Should-BeString -CaseSensitive "Object[]" } It "ishObjects.Count" { $totalLngObjects = $ishTopicCount*2 - $ishObjects.Length | Should -BeExactly $totalLngObjects + $ishObjects.Length | Should-Be $totalLngObjects } It "[0]GetType().BaseType.Name" { # Used to be IshObject, but more specific ISHType like IshDocumentObj or IshPublicationOutput is put on the pipeline - $ishObjects[0].GetType().Name | Should -BeExactly "IshDocumentObj" + $ishObjects[0].GetType().Name | Should-BeString -CaseSensitive "IshDocumentObj" } It "ishObjects[0].IshData" { { $ishObjects[0].IshData } | Should -Not -Throw } It "ishObjects[0].IshField" { - $ishObjects[0].IshField | Should -Not -BeNullOrEmpty + $ishObjects[0].IshField | Should-NotBeNull } It "ishObjects[0].IshRef" { - $ishObjects[0].IshRef | Should -Not -BeNullOrEmpty + $ishObjects[0].IshRef | Should-NotBeNull } It "ishObjects[0].IshType" { - $ishObjects[0].IshType | Should -Not -BeNullOrEmpty + $ishObjects[0].IshType | Should-NotBeNull } It "ishObjects[0].ObjectRef" { # Double check following 3 ReferenceType enum usage - $ishObjects[0].ObjectRef | Should -Not -BeNullOrEmpty - $ishObjects[0].VersionRef | Should -Not -BeNullOrEmpty - $ishObjects[0].LngRef | Should -Not -BeNullOrEmpty + $ishObjects[0].ObjectRef | Should-NotBeNull + $ishObjects[0].VersionRef | Should-NotBeNull + $ishObjects[0].LngRef | Should-NotBeNull } It "ishObjects[0] ConvertTo-Json" { - (ConvertTo-Json $ishObjects[0]).Length -gt 2 | Should -Be $true + (ConvertTo-Json $ishObjects[0]).Length -gt 2 | Should-Be $true } It "Option IshSession.DefaultRequestedMetadata" { - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" #logical - $ishObjects[0].ftitle_logical_value.Length -ge 1 | Should -Be $true + $ishObjects[0].ftitle_logical_value.Length -ge 1 | Should-Be $true #version - $ishObjects[0].version_version_value.Length -ge 1 | Should -Be $true + $ishObjects[0].version_version_value.Length -ge 1 | Should-Be $true #language - $ishObjects[0].fstatus.Length -ge 1 | Should -Be $true - $ishObjects[0].fstatus_lng_element.StartsWith('VSTATUS') | Should -Be $true - $ishObjects[0].fishstatustype -ge 0 | Should -Be $true + $ishObjects[0].fstatus.Length -ge 1 | Should-Be $true + $ishObjects[0].fstatus_lng_element.StartsWith('VSTATUS') | Should-Be $true + $ishObjects[0].fishstatustype -ge 0 | Should-Be $true } It "ishObjects[0].version_version_value" { # First version - ($ishobjects | Where-Object version_version_value -eq 1 | Select-Object).Length | Should -BeExactly $ishTopicCount + ($ishobjects | Where-Object version_version_value -eq 1 | Select-Object).Length | Should-Be $ishTopicCount # Second version - ($ishobjects | Where-Object version_version_value -eq 2 | Select-Object).Length | Should -BeExactly $ishTopicCount + ($ishobjects | Where-Object version_version_value -eq 2 | Select-Object).Length | Should-Be $ishTopicCount } } Context "Get-IshFolderContent BaseFolderGroup" { It "Parameter BaseFolder invalid" { - { Get-IshFolderContent -IShSession $ishSession -BaseFolder None } | Should -Throw + { Get-IshFolderContent -IShSession $ishSession -BaseFolder None } | Should-Throw } It "Parameter BaseFolder Data" { - (Get-IshFolderContent -IShSession $ishSession -BaseFolder Data).Count -eq 0 | Should -Be $true + (Get-IshFolderContent -IShSession $ishSession -BaseFolder Data).Count -eq 0 | Should-Be $true } It "Parameter BaseFolder System" { - (Get-IshFolderContent -IShSession $ishSession -BaseFolder System).Count -eq 0 | Should -Be $true + (Get-IshFolderContent -IShSession $ishSession -BaseFolder System).Count -eq 0 | Should-Be $true } It "Parameter BaseFolder Favorites" { { Get-IshFolderContent -IShSession $ishSession -BaseFolder Favorites } | Should -Not -Throw } It "Parameter BaseFolder EditorTemplate" { - (Get-IshFolderContent -IShSession $ishSession -BaseFolder EditorTemplate).Count -eq 0 | Should -Be $true + (Get-IshFolderContent -IShSession $ishSession -BaseFolder EditorTemplate).Count -eq 0 | Should-Be $true } } Context "Get-IshFolderContent FolderPathGroup" { It "Parameter FolderPath invalid" { - $exception = { Get-IshFolderContent -IShSession $ishSession -FolderPath "INVALIDFOLDERPATH" } | Should -Throw -PassThru + $exception = { Get-IshFolderContent -IShSession $ishSession -FolderPath "INVALIDFOLDERPATH" } | Should-Throw # 14.0.4 message is: [-102001] The folder 'INVALIDFOLDERPATH' does not exist. [name:"'INVALIDFOLDERPATH'"] [102001;InvalidObject] - $exception -like "*102001*" | Should -Be $true - $exception -like "*InvalidObject*" | Should -Be $true + $exception -like "*102001*" | Should-Be $true + $exception -like "*InvalidObject*" | Should-Be $true } It "Parameter FolderPath $folderTestRootPath" { - (Get-IshFolderContent -IshSession $ishSession -FolderPath $folderTestRootPath).Count -ge 0 | Should -Be $true + (Get-IshFolderContent -IshSession $ishSession -FolderPath $folderTestRootPath).Count -ge 0 | Should-Be $true } It "Parameter FolderPath Topic" { $folderPath = Get-IshFolderLocation -IshSession $ishSession -IshFolder $ishFolderTopic - (Get-IshFolderContent -IshSession $ishSession -FolderPath $folderPath).Count | Should -Be $ishTopicCount + (Get-IshFolderContent -IshSession $ishSession -FolderPath $folderPath).Count | Should-Be $ishTopicCount } } Context "Get-IshFolderContent FolderIdsGroup" { @@ -188,20 +188,20 @@ Describe "Get-IshFolderContent" -Tags "Read" { [long]$ishFolderEditorTemplateFolderRef = (Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate).IshFolderRef } It "Parameter FolderId invalid" { - { Get-IshFolderContent -IShSession $ishSession -FolderId "INVALIDFOLDERID" } | Should -Throw + { Get-IshFolderContent -IShSession $ishSession -FolderId "INVALIDFOLDERID" } | Should-Throw } It "Parameter FolderId from System" { - (Get-IshFolderContent -IshSession $ishSession -FolderId $ishFolderSystemFolderRef).Count -eq 0 | Should -Be $true + (Get-IshFolderContent -IshSession $ishSession -FolderId $ishFolderSystemFolderRef).Count -eq 0 | Should-Be $true } <# FolderId[] ValueFromPipeline is not implemented It "Pipeline FolderId" { $ishObjects = @($ishFolderDataFolderRef,$ishFolderSystemFolderRef,$ishFolderFavoritesFolderRef,$ishFolderEditorTemplateFolderRef) | Get-IshFolderContent -IshSession $ishSession - $ishObjects.Count -ge 0 | Should -Be $true + $ishObjects.Count -ge 0 | Should-Be $true } It "Pipeline FolderId MetadataBatchSize[1]" { $ishSession.MetadataBatchSize = 1 $ishObjects = @($ishFolderDataFolderRef,$ishFolderSystemFolderRef,$ishFolderFavoritesFolderRef,$ishFolderEditorTemplateFolderRef) | Get-IshFolderContent -IshSession $ishSession - $ishObjects.Count -ge 0 | Should -Be $true + $ishObjects.Count -ge 0 | Should-Be $true } #> } @@ -211,22 +211,22 @@ Describe "Get-IshFolderContent" -Tags "Read" { $ishFolderSystem = Get-IshFolder -IShSession $ishSession -BaseFolder System } It "Parameter IshFolder invalid" { - { Get-IshFolderContent -IShSession $ishSession -IshFolder "INVALIDFOLDERID" } | Should -Throw + { Get-IshFolderContent -IShSession $ishSession -IshFolder "INVALIDFOLDERID" } | Should-Throw } It "Parameter IshFolder Single with implicit IshSession" { - (Get-IshFolderContent -IshFolder $ishFolderSystem).Count -eq 0 | Should -Be $true + (Get-IshFolderContent -IshFolder $ishFolderSystem).Count -eq 0 | Should-Be $true } It "Parameter IshFolder Multiple with implicit IshSession" { $ishObjects = Get-IshFolderContent -IshFolder @($ishFolderData,$ishFolderSystem) - $ishObjects.Count -eq 0| Should -Be $true + $ishObjects.Count -eq 0| Should-Be $true } It "Pipeline IshFolder Single" { $ishObjects = $ishFolderData | Get-IshFolderContent -IshSession $ishSession - $ishObjects.Count -eq 0 | Should -Be $true + $ishObjects.Count -eq 0 | Should-Be $true } It "Pipeline IshFolder Multiple" { $ishObjects = @($ishFolderData,$ishFolderSystem) | Get-IshFolderContent -IshSession $ishSession - $ishObjects.Count -eq 0| Should -Be $true + $ishObjects.Count -eq 0| Should-Be $true } } Context "Get-IshFolderContent IshFoldersGroup mixing MetadataFilter and VersionFilter/LanguagesFilter" { @@ -245,69 +245,69 @@ Describe "Get-IshFolderContent" -Tags "Read" { $ishDocumentObjsLanguageFilterOverridesMetadatafilter = Get-IshFolderContent -IshSession $ishSession -IshFolder $ishFolderTopic -LanguagesFilter $ishLng -MetadataFilter $metadataFilter } It "Parameter VersionFilter" { - $ishDocumentObjsVersionOne.Count | Should -Be $ishTopicCount - $ishDocumentObjsVersionLatest.Count | Should -Be $ishTopicCount - $ishDocumentObjsVersionOne.Count -eq $ishDocumentObjsVersionLatest.Count | Should -Be $true + $ishDocumentObjsVersionOne.Count | Should-Be $ishTopicCount + $ishDocumentObjsVersionLatest.Count | Should-Be $ishTopicCount + $ishDocumentObjsVersionOne.Count -eq $ishDocumentObjsVersionLatest.Count | Should-Be $true } It "Parameter LanguagesFilter" { - $ishDocumentObjsAllLanguages.Count | Should -Be $ishTopicCount - $ishDocumentObjsExplicitLanguage.Count | Should -Be $ishTopicCount - $ishDocumentObjsAllLanguages.Count -eq $ishDocumentObjsExplicitLanguage.Count | Should -Be $true + $ishDocumentObjsAllLanguages.Count | Should-Be $ishTopicCount + $ishDocumentObjsExplicitLanguage.Count | Should-Be $ishTopicCount + $ishDocumentObjsAllLanguages.Count -eq $ishDocumentObjsExplicitLanguage.Count | Should-Be $true } It "Parameter LanguagesFilter and matching status MetadataFilter" { - $ishDocumentObjsExplicitLanguageAndStatus.Count -eq $ishDocumentObjsExplicitLanguage.Count | Should -Be $true + $ishDocumentObjsExplicitLanguageAndStatus.Count -eq $ishDocumentObjsExplicitLanguage.Count | Should-Be $true } It "Parameter LanguagesFilter and non-matching status MetadataFilter" { - $ishDocumentObjsExplicitLanguageAndWrong.Count | Should -Be 0 + $ishDocumentObjsExplicitLanguageAndWrong.Count | Should-Be 0 } It "Parameter LanguagesFilter and matching language MetadataFilter" { - $ishDocumentObjsExplicitLanguageAndLanguage.Count | Should -Be $ishTopicCount + $ishDocumentObjsExplicitLanguageAndLanguage.Count | Should-Be $ishTopicCount } It "Parameter LanguagesFilter overrides MetadataFilter (non-matching language filter)" { - $ishDocumentObjsLanguageFilterOverridesMetadatafilter.Count | Should -Be 3 + $ishDocumentObjsLanguageFilterOverridesMetadatafilter.Count | Should-Be 3 } } Context "Get-IshFolderContent use LanguagesFilter" { It "LanguagesFilter on '$ishLngLabel' language" { $ishObjects = Get-IshFolderContent -IShSession $ishSession -IshFolder $ishFolderTopic -LanguagesFilter "$ishLngLabel" # en - $ishObjects.Count | Should -Be $ishTopicCount + $ishObjects.Count | Should-Be $ishTopicCount } It "LanguagesFilter on '$ishLngTarget2Label, $ishLngLabel' languages" { $ishObjects = Get-IshFolderContent -IShSession $ishSession -IshFolder $ishFolderTopic -LanguagesFilter @("$ishLngTarget2Label", "$ishLngLabel") # de, en - $ishObjects.Count | Should -Be $ishTopicCount + $ishObjects.Count | Should-Be $ishTopicCount } It "LanguagesFilter on '$ishLngTarget1Label' language (filtering out results)" { $ishObjects = Get-IshFolderContent -IShSession $ishSession -IshFolder $ishFolderTopic -LanguagesFilter @("$ishLngTarget1Label") # es - $ishObjects.Count | Should -Be 0 + $ishObjects.Count | Should-Be 0 } It "LanguagesFilter overrides MetadataFilter" { $metadataFilter = Set-IshMetadataFilterField -Name "DOC-LANGUAGE" -Level Lng -Value "$ishLngTarget1Label" -ValueType Value # es $ishObjects = Get-IshFolderContent -IShSession $ishSession -IshFolder $ishFolderTopic -MetadataFilter $metadataFilter -LanguagesFilter @("$ishLngTarget2Label", "$ishLngLabel") # de, en - $ishObjects.Count | Should -Be $ishTopicCount + $ishObjects.Count | Should-Be $ishTopicCount } } Context "Get-IshFolderContent use MetadataFilter" { It "Metadata filter on FSTATUS" { $metadataFilter = Set-IshMetadataFilterField -Name "FSTATUS" -Level Lng -Value $ishStatusDraft -ValueType Element $ishObjects = Get-IshFolderContent -IShSession $ishSession -IshFolder $ishFolderTopic -MetadataFilter $metadataFilter - $ishObjects.Count | Should -Be $ishTopicCount + $ishObjects.Count | Should-Be $ishTopicCount } It "Metadata filter on FSTATUS (filtering out results)" { $metadataFilter = Set-IshMetadataFilterField -Name "FSTATUS" -Level Lng -Value $ishStatusReleased -ValueType Element $ishObjects = Get-IshFolderContent -IShSession $ishSession -IshFolder $ishFolderTopic -MetadataFilter $metadataFilter - $ishObjects.Count | Should -Be 0 + $ishObjects.Count | Should-Be 0 } It "Metadata filter on FSTATUS,DOC-LANGUAGE" { $metadataFilter = Set-IshMetadataFilterField -Name "FSTATUS" -Level Lng -Value $ishStatusDraft -ValueType Element | Set-IshMetadataFilterField -Name "DOC-LANGUAGE" -Level Lng -Value "$ishLngLabel" -ValueType Value # en $ishObjects = Get-IshFolderContent -IShSession $ishSession -IshFolder $ishFolderTopic -MetadataFilter $metadataFilter - $ishObjects.Count | Should -Be $ishTopicCount + $ishObjects.Count | Should-Be $ishTopicCount } It "Metadata filter on (FSTATUS, DOC-LANGUAGE) with LanguagesFilter override" { $metadataFilter = Set-IshMetadataFilterField -Name "FSTATUS" -Level Lng -Value $ishStatusDraft -ValueType Element | Set-IshMetadataFilterField -Name "DOC-LANGUAGE" -Level Lng -Value "$ishLngLabel" -ValueType Value # en $ishObjects = Get-IshFolderContent -IShSession $ishSession -IshFolder $ishFolderTopic -MetadataFilter $metadataFilter -LanguagesFilter @("$ishLngTarget2Label", "$ishLngTarget1Label") # de, es - $ishObjects.Count | Should -Be 0 + $ishObjects.Count | Should-Be 0 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/GetIshFolderLocation.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/GetIshFolderLocation.Tests.ps1 index ec9e96f..b7139a9 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/GetIshFolderLocation.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/GetIshFolderLocation.Tests.ps1 @@ -9,41 +9,41 @@ BeforeAll { Describe "Get-IshFolderLocation" -Tags "Read" { Context "Get-IshFolderLocation ParameterGroup" { It "Parameter IshSession invalid" { - { Get-IshFolderLocation -IShSession "INVALIDISHSESSION" } | Should -Throw + { Get-IshFolderLocation -IShSession "INVALIDISHSESSION" } | Should-Throw } } Context "Get-IshFolderLocation returns string object" { It "GetType().Name" { $ishObjects = Get-IshFolderLocation -IShSession $ishSession -BaseFolder Data - $ishObjects.GetType().Name | Should -BeExactly "String" + $ishObjects.GetType().Name | Should-BeString -CaseSensitive "String" } } Context "Get-IshFolderLocation BaseFolderGroup" { It "Parameter BaseFolder invalid" { - { Get-IshFolderLocation -IShSession $ishSession -BaseFolder None } | Should -Throw + { Get-IshFolderLocation -IShSession $ishSession -BaseFolder None } | Should-Throw } It "Parameter BaseFolder Data" { - Get-IshFolderLocation -IShSession $ishSession -BaseFolder Data | Should -Not -BeNullOrEmpty + Get-IshFolderLocation -IShSession $ishSession -BaseFolder Data | Should-NotBeNull } It "Parameter BaseFolder System" { - Get-IshFolderLocation -IShSession $ishSession -BaseFolder System | Should -Not -BeNullOrEmpty + Get-IshFolderLocation -IShSession $ishSession -BaseFolder System | Should-NotBeNull } It "Parameter BaseFolder Favorites" { - Get-IshFolderLocation -IShSession $ishSession -BaseFolder Favorites | Should -Not -BeNullOrEmpty + Get-IshFolderLocation -IShSession $ishSession -BaseFolder Favorites | Should-NotBeNull } It "Parameter BaseFolder EditorTemplate" { - Get-IshFolderLocation -IShSession $ishSession -BaseFolder EditorTemplate | Should -Not -BeNullOrEmpty + Get-IshFolderLocation -IShSession $ishSession -BaseFolder EditorTemplate | Should-NotBeNull } } Context "Get-IshFolderLocation FolderPathGroup" { It "Parameter FolderPath invalid" { - $exception = { Get-IshFolderLocation -IShSession $ishSession -FolderPath "INVALIDFOLDERPATH" } | Should -Throw -PassThru + $exception = { Get-IshFolderLocation -IShSession $ishSession -FolderPath "INVALIDFOLDERPATH" } | Should-Throw # 14.0.4 message is: [-102001] The folder 'INVALIDFOLDERPATH' does not exist. [name:"'INVALIDFOLDERPATH'"] [102001;InvalidObject] - $exception -like "*102001*" | Should -Be $true - $exception -like "*InvalidObject*" | Should -Be $true + $exception -like "*102001*" | Should-Be $true + $exception -like "*InvalidObject*" | Should-Be $true } It "Parameter FolderPath $folderTestRootPath" { - Get-IshFolderLocation -IshSession $ishSession -FolderPath $folderTestRootPath | Should -Be $folderTestRootPath + Get-IshFolderLocation -IshSession $ishSession -FolderPath $folderTestRootPath | Should-Be $folderTestRootPath } } Context "Get-IshFolderLocation FolderIdsGroup" { @@ -54,25 +54,25 @@ Describe "Get-IshFolderLocation" -Tags "Read" { [long]$ishFolderEditorTemplateFolderRef = (Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate).IshFolderRef } It "Parameter FolderId invalid" { - { Get-IshFolderLocation -IShSession $ishSession -FolderId "INVALIDFOLDERID" } | Should -Throw + { Get-IshFolderLocation -IShSession $ishSession -FolderId "INVALIDFOLDERID" } | Should-Throw } It "Parameter FolderId from EditorTemplate" { - Get-IshFolderLocation -IshSession $ishSession -FolderId $ishFolderEditorTemplateFolderRef | Should -Not -BeNullOrEmpty + Get-IshFolderLocation -IshSession $ishSession -FolderId $ishFolderEditorTemplateFolderRef | Should-NotBeNull } It "Parameter FolderId 0 no longer returns BaseFolder" { - $exception = { Get-IshFolderLocation -FolderId 0 } | Should -Throw -PassThru + $exception = { Get-IshFolderLocation -FolderId 0 } | Should-Throw # 14.0.4 message is: [-105001] The parameter folderRef with value "0" is invalid. Zero is not allowed as valid value. [105001;InvalidParameter] - $exception -like "*105001*" | Should -Be $true - $exception -like "*InvalidParameter*" | Should -Be $true + $exception -like "*105001*" | Should-Be $true + $exception -like "*InvalidParameter*" | Should-Be $true } It "Pipeline FolderId" { $ishObjects = @($ishFolderDataFolderRef,$ishFolderSystemFolderRef,$ishFolderFavoritesFolderRef,$ishFolderEditorTemplateFolderRef) | Get-IshFolderLocation -IshSession $ishSession - $ishObjects.Count | Should -Be 4 + $ishObjects.Count | Should-Be 4 } It "Pipeline FolderId MetadataBatchSize[1]" { $ishSession.MetadataBatchSize = 1 $ishObjects = @($ishFolderDataFolderRef,$ishFolderSystemFolderRef,$ishFolderFavoritesFolderRef,$ishFolderEditorTemplateFolderRef) | Get-IshFolderLocation -IshSession $ishSession - $ishObjects.Count | Should -Be 4 + $ishObjects.Count | Should-Be 4 } } Context "Get-IshFolderLocation IshFoldersGroup" { @@ -83,23 +83,23 @@ Describe "Get-IshFolderLocation" -Tags "Read" { $ishFolderEditorTemplate = Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate } It "Parameter IshFolder invalid" { - { Get-IshFolderLocation -IShSession $ishSession -IshFolder "INVALIDFOLDERID" } | Should -Throw + { Get-IshFolderLocation -IShSession $ishSession -IshFolder "INVALIDFOLDERID" } | Should-Throw } It "Parameter IshFolder Single with implicit IshSession" { $ishObjects = Get-IshFolderLocation -IshFolder $ishFolderEditorTemplate - $ishObjects.Count | Should -Be 1 + $ishObjects.Count | Should-Be 1 } It "Parameter IshFolder Multiple with implicit IshSession" { $ishObjects = Get-IshFolderLocation -IshFolder @($ishFolderData,$ishFolderSystem) - $ishObjects.Count | Should -Be 2 + $ishObjects.Count | Should-Be 2 } It "Pipeline IshFolder Single" { $ishObjects = @($ishFolderData) | Get-IshFolderLocation -IshSession $ishSession - $ishObjects.Count | Should -Be 1 + $ishObjects.Count | Should-Be 1 } It "Pipeline IshFolder Multiple" { $ishObjects = @($ishFolderData,$ishFolderSystem,$ishFolderFavorites,$ishFolderEditorTemplate) | Get-IshFolderLocation -IshSession $ishSession - $ishObjects.Count | Should -Be 4 + $ishObjects.Count | Should-Be 4 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/MoveIshFolder.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/MoveIshFolder.Tests.ps1 index 4d2d532..65d038f 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/MoveIshFolder.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/MoveIshFolder.Tests.ps1 @@ -29,7 +29,7 @@ BeforeAll { Describe "Move-IshFolder" -Tags "Create" { Context "Move-IshFolder ParameterGroup" { It "Parameter IshSession invalid" { - { Move-IshFolder -IShSession "INVALIDISHSESSION" } | Should -Throw + { Move-IshFolder -IShSession "INVALIDISHSESSION" } | Should-Throw } } Context "Move-IshFolder returns IshFolder object" { @@ -37,43 +37,43 @@ Describe "Move-IshFolder" -Tags "Create" { $ishFolderData = Move-IshFolder -IShSession $ishSession -FolderId $ishFolderB.IshFolderRef -ToFolderId $ishFolderA.IshFolderRef } It "GetType().Name" { - $ishFolderData.GetType().Name | Should -BeExactly "IshFolder" + $ishFolderData.GetType().Name | Should-BeString -CaseSensitive "IshFolder" } It "$ishFolderData.IshFolderRef" { - $ishFolderData.IshFolderRef -eq $ishFolderB.IshFolderRef | Should -Be $true + $ishFolderData.IshFolderRef -eq $ishFolderB.IshFolderRef | Should-Be $true } It "$ishFolderData.IshFolderType" { - $ishFolderData.IshFolderType | Should -Not -BeNullOrEmpty + $ishFolderData.IshFolderType | Should-NotBeNull } It "$ishFolderData.IshField" { - $ishFolderData.IshField | Should -Not -BeNullOrEmpty + $ishFolderData.IshField | Should-NotBeNull } It "Option IshSession.DefaultRequestedMetadata" { - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" - $ishFolderData.name.Length -ge 1 | Should -Be $true - $ishFolderData.fdocumenttype.Length -ge 1 | Should -Be $true - $ishFolderData.fdocumenttype_none_element.StartsWith('VDOCTYPE') | Should -Be $true + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" + $ishFolderData.name.Length -ge 1 | Should-Be $true + $ishFolderData.fdocumenttype.Length -ge 1 | Should-Be $true + $ishFolderData.fdocumenttype_none_element.StartsWith('VDOCTYPE') | Should-Be $true } } Context "Move-IshFolder IshFoldersGroup" { It "Parameter IshFolder invalid" { - { Move-IshFolder -IShSession $ishSession -IshFolder "INVALIDFOLDERID" -ToFolderId $ishFolderA.IshFolderRef } | Should -Throw + { Move-IshFolder -IShSession $ishSession -IshFolder "INVALIDFOLDERID" -ToFolderId $ishFolderA.IshFolderRef } | Should-Throw } It "Parameter IshFolder Single with implicit IshSession" { $ishFolders = Move-IshFolder -IshFolder $ishFolderC -ToFolderId $ishFolderA.IshFolderRef - $ishFolders.Count | Should -Be 1 + $ishFolders.Count | Should-Be 1 } It "Parameter IshFolder Multiple with implicit IshSession" { $ishFolders = Move-IshFolder -IshFolder @($ishFolderD,$ishFolderE) -ToFolderId $ishFolderA.IshFolderRef - $ishFolders.Count | Should -Be 2 + $ishFolders.Count | Should-Be 2 } It "Pipeline IshFolder Single" { $ishFolders = $ishFolderF | Move-IshFolder -IshSession $ishSession -ToFolderId $ishFolderA.IshFolderRef - $ishFolders.Count | Should -Be 1 + $ishFolders.Count | Should-Be 1 } It "Pipeline IshFolder Multiple" { $ishFolders = @($ishFolderG,$ishFolderH) | Move-IshFolder -IshSession $ishSession -ToFolderId $ishFolderA.IshFolderRef - $ishFolders.Count | Should -Be 2 + $ishFolders.Count | Should-Be 2 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/RemoveIshFolder.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/RemoveIshFolder.Tests.ps1 index d8ef9ff..635f0ae 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/RemoveIshFolder.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/RemoveIshFolder.Tests.ps1 @@ -36,22 +36,22 @@ Describe "Remove-IshFolder" -Tags "Create" { } Context "Remove-IshFolder FolderIdGroup" { It "Parameter IshSession invalid" { - { Remove-IshFolder -IShSession "INVALIDISHSESSION" -FolderId "-7" } | Should -Throw + { Remove-IshFolder -IShSession "INVALIDISHSESSION" -FolderId "-7" } | Should-Throw } It "Parameter FolderId 0" { { Remove-IshFolder -IShSession $ishSession -FolderId 0 } | Should -Not -Throw } It "Parameter FolderId \General\" { - { Remove-IshFolder -IShSession $ishSession -FolderId (Get-IshFolder -IshSession $ishSession -BaseFolder Data).IshFolderRef } | Should -Throw + { Remove-IshFolder -IShSession $ishSession -FolderId (Get-IshFolder -IshSession $ishSession -BaseFolder Data).IshFolderRef } | Should-Throw } It "Remove-IshFolder returns nothing" { $ishFolder = Remove-IshFolder -IshSession $ishSession -FolderId $ishFolderFolderIdGroup.IshFolderRef - $ishFolder -eq $null | Should -Be $true + $ishFolder -eq $null | Should-Be $true } } Context "Remove-IshFolder FolderPathGroup" { It "Parameter FolderPathGroup invalid" { - { Remove-IshFolder -IShSession $ishSession -FolderPath "INVALIDFOLDERPATH" } | Should -Throw + { Remove-IshFolder -IShSession $ishSession -FolderPath "INVALIDFOLDERPATH" } | Should-Throw } It "Parameter FolderPathGroup FolderPathGroup" { { Remove-IshFolder -IShSession $ishSession -FolderPath ($folderTestRootPath + $ishSession.FolderPathSeparator + $cmdletName + $ishSession.FolderPathSeparator + "FolderPathGroup") } | Should -Not -Throw @@ -65,7 +65,7 @@ Describe "Remove-IshFolder" -Tags "Create" { $ishFolderEditorTemplate = Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate } It "Parameter IshFolder invalid" { - { Remove-IshFolder -IShSession $ishSession -IshFolder "INVALIDFOLDERID" } | Should -Throw + { Remove-IshFolder -IShSession $ishSession -IshFolder "INVALIDFOLDERID" } | Should-Throw } It "Parameter IshFolder Single with implicit IshSession" { { Remove-IshFolder -IshFolder $ishFolderIshFoldersGroup } | Should -Not -Throw @@ -74,7 +74,7 @@ Describe "Remove-IshFolder" -Tags "Create" { { Remove-IshFolder -IshFolder @($ishFolderIshFoldersGroupA,$ishFolderIshFoldersGroupB) } | Should -Not -Throw } It "Pipeline IshFolder" { - { @($ishFolderData,$ishFolderSystem,$ishFolderFavorites) | Remove-IshFolder -IshSession $ishSession } | Should -Throw + { @($ishFolderData,$ishFolderSystem,$ishFolderFavorites) | Remove-IshFolder -IshSession $ishSession } | Should-Throw } It "Pipeline IshFolder Multiple" { { @($ishFolderIshFoldersGroupC,$ishFolderIshFoldersGroupD) | Remove-IshFolder -IshSession $ishSession } | Should -Not -Throw @@ -83,7 +83,7 @@ Describe "Remove-IshFolder" -Tags "Create" { Context "Remove-IshFolder Recurse" { It "Parameter FolderIdGroup" { $ishFolder = Remove-IshFolder -IshSession $ishSession -FolderId $ishFolderAllYourBase.IshFolderRef -Recurse - $ishFolder -eq $null | Should -Be $true + $ishFolder -eq $null | Should-Be $true } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/SetIshFolder.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/SetIshFolder.Tests.ps1 index 35be509..d5b0bc6 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/SetIshFolder.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Folder/SetIshFolder.Tests.ps1 @@ -1,3 +1,4 @@ +#pester:no-parallel # renames the BaseFolders which could confuse other parallel tests BeforeAll { $cmdletName = "Set-IshFolder" Write-Host ("`r`nLoading ISHRemote.PesterSetup.ps1 on PSVersion[" + $psversionTable.PSVersion + "] over BeforeAll-block for MyCommand[" + $cmdletName + "]...") @@ -37,7 +38,7 @@ BeforeAll { Describe "Set-IshFolder" -Tags "Create" { Context "Set-IshFolder ParameterGroup" { It "Parameter IshSession invalid" { - { Set-IshFolder -IShSession "INVALIDISHSESSION" } | Should -Throw + { Set-IshFolder -IShSession "INVALIDISHSESSION" } | Should-Throw } } Context "Set-IshFolder returns IshFolder object" { @@ -45,34 +46,34 @@ Describe "Set-IshFolder" -Tags "Create" { $ishFolderData = Set-IshFolder -IShSession $ishSession -IshFolder $ishFolderA } It "GetType().Name" { - $ishFolderData.GetType().Name | Should -BeExactly "IshFolder" + $ishFolderData.GetType().Name | Should-BeString -CaseSensitive "IshFolder" } It "ishFolderData.IshFolderRef" { - $ishFolderData.IshFolderRef -ge 0 | Should -Be $true + $ishFolderData.IshFolderRef -ge 0 | Should-Be $true } It "ishFolderData.IshFolderType" { - $ishFolderData.IshFolderType | Should -Not -BeNullOrEmpty + $ishFolderData.IshFolderType | Should-NotBeNull } It "ishFolderData.IshField" { - $ishFolderData.IshField | Should -Not -BeNullOrEmpty + $ishFolderData.IshField | Should-NotBeNull } It "Option IshSession.DefaultRequestedMetadata" { - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" - $ishFolderData.name.Length -ge 1 | Should -Be $true - $ishFolderData.fdocumenttype.Length -ge 1 | Should -Be $true - $ishFolderData.fdocumenttype_none_element.StartsWith('VDOCTYPE') | Should -Be $true + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" + $ishFolderData.name.Length -ge 1 | Should-Be $true + $ishFolderData.fdocumenttype.Length -ge 1 | Should-Be $true + $ishFolderData.fdocumenttype_none_element.StartsWith('VDOCTYPE') | Should-Be $true } } # Order in renames matters Context "Set-IshFolder FolderPathGroup" { It "Parameter FolderPath invalid" { - $exception = { Set-IshFolder -IShSession $ishSession -FolderPath "INVALIDFOLDERPATH" -NewFolderName "FolderPathGroup INVALIDFOLDERPATH" } | Should -Throw -PassThru + $exception = { Set-IshFolder -IShSession $ishSession -FolderPath "INVALIDFOLDERPATH" -NewFolderName "FolderPathGroup INVALIDFOLDERPATH" } | Should-Throw # 14.0.4 message is: [-102001] The folder 'INVALIDFOLDERPATH' does not exist. [name:"'INVALIDFOLDERPATH'"] [102001;InvalidObject] - $exception -like "*102001*" | Should -Be $true - $exception -like "*InvalidObject*" | Should -Be $true + $exception -like "*102001*" | Should-Be $true + $exception -like "*InvalidObject*" | Should-Be $true } It "Parameter FolderPath $folderTestRootPath" { - Set-IshFolder -IshSession $ishSession -FolderPath (Join-Path $folderCmdletRootPath "FolderB") -NewFolderName "FolderPathGroup $cmdletName" | Should -Not -BeNullOrEmpty + Set-IshFolder -IshSession $ishSession -FolderPath (Join-Path $folderCmdletRootPath "FolderB") -NewFolderName "FolderPathGroup $cmdletName" | Should-NotBeNull } } Context "Set-IshFolder BaseFolderGroup" { @@ -83,23 +84,23 @@ Describe "Set-IshFolder" -Tags "Create" { $ishFolderEditorTemplateOriginalName = Get-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate | Get-IshMetadataField -IshSession $ishSession -Name "FNAME" } It "Parameter BaseFolder invalid" { - { Set-IshFolder -IShSession $ishSession -BaseFolder None } | Should -Throw + { Set-IshFolder -IShSession $ishSession -BaseFolder None } | Should-Throw } It "Parameter BaseFolder Data" { Set-IshFolder -IShSession $ishSession -BaseFolder Data -NewFolderName "Set-IshFolder BaseFolderGroup Data" - Set-IshFolder -IShSession $ishSession -BaseFolder Data -NewFolderName $ishFolderDataOrginalName | Should -Not -BeNullOrEmpty + Set-IshFolder -IShSession $ishSession -BaseFolder Data -NewFolderName $ishFolderDataOrginalName | Should-NotBeNull } It "Parameter BaseFolder System" { Set-IshFolder -IShSession $ishSession -BaseFolder System -NewFolderName "Set-IshFolder BaseFolderGroup System" - Set-IshFolder -IShSession $ishSession -BaseFolder System -NewFolderName $ishFolderSystemOriginalName | Should -Not -BeNullOrEmpty + Set-IshFolder -IShSession $ishSession -BaseFolder System -NewFolderName $ishFolderSystemOriginalName | Should-NotBeNull } It "Parameter BaseFolder Favorites" { Set-IshFolder -IShSession $ishSession -BaseFolder Favorites -NewFolderName "Set-IshFolder BaseFolderGroup Favorites" - Set-IshFolder -IShSession $ishSession -BaseFolder Favorites -NewFolderName $ishFolderFavoritesOriginalName | Should -Not -BeNullOrEmpty + Set-IshFolder -IShSession $ishSession -BaseFolder Favorites -NewFolderName $ishFolderFavoritesOriginalName | Should-NotBeNull } It "Parameter BaseFolder EditorTemplate" { Set-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate -NewFolderName "Set-IshFolder BaseFolderGroup EditorTemplate" - Set-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate -NewFolderName $ishFolderEditorTemplateOriginalName | Should -Not -BeNullOrEmpty + Set-IshFolder -IShSession $ishSession -BaseFolder EditorTemplate -NewFolderName $ishFolderEditorTemplateOriginalName | Should-NotBeNull } } Context "Set-IshFolder FolderIdsGroup" { @@ -111,43 +112,43 @@ Describe "Set-IshFolder" -Tags "Create" { [long]$ishFolderGFolderRef = (Get-IshFolder -IShSession $ishSession -FolderPath (Join-Path $folderCmdletRootPath "FolderG")).IshFolderRef } It "Parameter FolderId invalid" { - { Set-IshFolder -IShSession $ishSession -FolderId "INVALIDFOLDERID" } | Should -Throw + { Set-IshFolder -IShSession $ishSession -FolderId "INVALIDFOLDERID" } | Should-Throw } It "Parameter FolderId Single" { - Set-IshFolder -IshSession $ishSession -FolderId $ishFolderCFolderRef -NewFolderName "FolderIdsGroup C Rename" | Should -Not -BeNullOrEmpty + Set-IshFolder -IshSession $ishSession -FolderId $ishFolderCFolderRef -NewFolderName "FolderIdsGroup C Rename" | Should-NotBeNull } It "Parameter FolderId Multiple" { - { Set-IshFolder -IshSession $ishSession -FolderId $ishFolderDFolderRef,$ishFolderEFolderRef -NewFolderName "FolderIdsGroup D,E Rename" } | Should -Throw + { Set-IshFolder -IshSession $ishSession -FolderId $ishFolderDFolderRef,$ishFolderEFolderRef -NewFolderName "FolderIdsGroup D,E Rename" } | Should-Throw } It "Pipeline FolderId Single" { $ishObjects = @($ishFolderDFolderRef,$ishFolderEFolderRef) | Set-IshFolder -IshSession $ishSession -ReadAccess $readAccessTestRootOriginal - $ishObjects.Count | Should -Be 2 + $ishObjects.Count | Should-Be 2 } It "Pipeline FolderId Multiple" { $ishObjects = @($ishFolderFFolderRef,$ishFolderGFolderRef) | Set-IshFolder -IshSession $ishSession -ReadAccess $readAccessTestRootOriginal - $ishObjects.Count | Should -Be 2 + $ishObjects.Count | Should-Be 2 } } # Most cmdldets take IshFolder pipeline to apply on, this one will apply the incoming IshFolder Context "Set-IshFolder IshFoldersGroup" { It "Parameter IshFolder invalid" { - { Set-IshFolder -IShSession $ishSession -IshFolder "INVALIDFOLDERID" } | Should -Throw + { Set-IshFolder -IShSession $ishSession -IshFolder "INVALIDFOLDERID" } | Should-Throw } It "Parameter IshFolder Single with implicit IshSession" { $ishFolders = Set-IshFolder -IshFolder $ishFolderK - $ishFolders.Count | Should -Be 1 + $ishFolders.Count | Should-Be 1 } It "Parameter IshFolder Multiple with implicit IshSession" { $ishFolders = Set-IshFolder -IshFolder @($ishFolderL,$ishFolderM) - $ishFolders.Count | Should -Be 2 + $ishFolders.Count | Should-Be 2 } It "Pipeline IshFolder Single" { $ishFolders = $ishFolderN | Set-IshFolder -IshSession $ishSession - $ishFolders.Count | Should -Be 1 + $ishFolders.Count | Should-Be 1 } It "Pipeline IshFolder Multiple" { $ishFolders = @($ishFolderO,$ishFolderP) | Set-IshFolder -IshSession $ishSession - $ishFolders.Count | Should -Be 2 + $ishFolders.Count | Should-Be 2 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/ListOfValues/AddIshLovValue.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/ListOfValues/AddIshLovValue.Tests.ps1 index 87ee345..e698559 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/ListOfValues/AddIshLovValue.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/ListOfValues/AddIshLovValue.Tests.ps1 @@ -9,7 +9,7 @@ BeforeAll { Describe "Add-IshLovValue" -Tags "Create" { Context "Add-IshLovValue ParameterGroup" { It "Parameter IshSession invalid" { - { Add-IshLovValue -IShSession "INVALIDISHSESSION" -LovId $ishLovId -Label "ISHRemote $ishLovId Entry" -Description "ISHRemote $ishLovId Entry Description" -IshLovValue "ISHREMOTE$ishLovId" } | Should -Throw + { Add-IshLovValue -IShSession "INVALIDISHSESSION" -LovId $ishLovId -Label "ISHRemote $ishLovId Entry" -Description "ISHRemote $ishLovId Entry Description" -IshLovValue "ISHREMOTE$ishLovId" } | Should-Throw } } Context "Add-IshLovValue returns IshLovValue object" { @@ -21,25 +21,25 @@ Describe "Add-IshLovValue" -Tags "Create" { $ishLovValue = Add-IshLovValue -IShSession $ishSession -LovId $ishLovId -Label $label -Description $description -LovValueId $lovValueId } It "GetType().Name" { - $ishLovValue.GetType().Name | Should -BeExactly "IshLovValue" + $ishLovValue.GetType().Name | Should-BeString -CaseSensitive "IshLovValue" } It "ishLovValue.IshLovValueRef" { - $ishLovValue.IshLovValueRef -ge 0 | Should -Be $true + $ishLovValue.IshLovValueRef -ge 0 | Should-Be $true } It "ishLovValue.LovId" { - $ishLovValue.LovId | Should -Be "$ishLovId" + $ishLovValue.LovId | Should-Be "$ishLovId" } It "ishLovValue.IshRef" { - $ishLovValue.IshRef | Should -Be $lovValueId + $ishLovValue.IshRef | Should-Be $lovValueId } It "ishLovValue.Label" { - $ishLovValue.Label | Should -Be $label + $ishLovValue.Label | Should-Be $label } It "ishLovValue.Description" { - $ishLovValue.Description | Should -Be $description + $ishLovValue.Description | Should-Be $description } It "ishLovValue.Active" { - $ishLovValue.Active | Should -Be $True + $ishLovValue.Active | Should-Be $True } } Context "Add-IshLovValue IshLovValueGroup" { @@ -51,31 +51,31 @@ Describe "Add-IshLovValue" -Tags "Create" { $ishLovValue = Add-IshLovValue -IShSession $ishSession -LovId $ishLovId -Label $label -Description $description -LovValueId $lovValueId } It "Parameter IshLovValue invalid" { - { Add-IshLovValue -IShSession $ishSession -IshLovValue "INVALIDLOVVALUE" } | Should -Throw + { Add-IshLovValue -IShSession $ishSession -IshLovValue "INVALIDLOVVALUE" } | Should-Throw } It "Parameter IshLovValue Single with optional IshSession" { Remove-IshLovValue -LovId $ishLovId -LovValueId $lovValueId $ishLovValues = Add-IshLovValue -IshLovValue $ishLovValue - $ishLovValues.Count | Should -Be 1 + $ishLovValues.Count | Should-Be 1 } <# NotImplemented It "Parameter IshLovValue Multiple" { $ishFolderEditorTemplate.IshField = $ishFolderEditorTemplate.IshField | Set-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -Value "EditorTemplate IshFoldersGroup Parameter IshFolder Multiple" $ishFolderFavorites.IshField = $ishFolderFavorites.IshField | Set-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -Value "Favorites IshFoldersGroup Parameter IshFolder Multiple" $ishFolders = Add-IshFolder -IshSession $ishSession -IshFolder @($ishFolderEditorTemplate,$ishFolderFavorites) -ParentFolderId $ishFolderCmdlet.IshFolderRef - $ishFolders.Count | Should -Be 2 + $ishFolders.Count | Should-Be 2 } #> It "Pipeline IshLovValue Single" { Remove-IshLovValue -IshSession $ishSession -LovId $ishLovId -LovValueId $lovValueId $ishLovValues = $ishLovValue | Add-IshLovValue -IShSession $ishSession - $ishLovValues.Count | Should -Be 1 + $ishLovValues.Count | Should-Be 1 } <# NotImplemented It "Pipeline IshLovValue Multiple" { $ishFolderData.IshField = $ishFolderData.IshField | Set-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -Value "EditorTemplate IshFoldersGroup Pipeline IshFolder Multiple" $ishFolderSystem.IshField = $ishFolderSystem.IshField | Set-IshMetadataField -IshSession $ishSession -Name "FNAME" -Level None -Value "System IshFoldersGroup Pipeline IshFolder Multiple" $ishFolders = @($ishFolderData,$ishFolderSystem) | Add-IshFolder -IshSession $ishSession -ParentFolderId $ishFolderCmdlet.IshFolderRef - $ishFolders.Count | Should -Be 2 + $ishFolders.Count | Should-Be 2 } #> } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/ListOfValues/GetIshLovValue.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/ListOfValues/GetIshLovValue.Tests.ps1 index 2aeba80..c1f9063 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/ListOfValues/GetIshLovValue.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/ListOfValues/GetIshLovValue.Tests.ps1 @@ -9,7 +9,7 @@ BeforeAll { Describe "Get-IshLovValue" -Tags "Create" { Context "Get-IshLovValue ParameterGroup" { It "Parameter IshSession invalid" { - { Get-IshLovValue -IShSession "INVALIDISHSESSION" -LovId $ishLovId -IshLovValue "ISHREMOTE$ishLovId" } | Should -Throw + { Get-IshLovValue -IShSession "INVALIDISHSESSION" -LovId $ishLovId -IshLovValue "ISHREMOTE$ishLovId" } | Should-Throw } } Context "Get-IshLovValue returns one IshLovValue object" { @@ -18,37 +18,37 @@ Describe "Get-IshLovValue" -Tags "Create" { $ishLovValue = Get-IshLovValue -IShSession $ishSession -LovId $ishLovId -LovValueId $ishLovValueId } It "GetType().Name" { - $ishLovValue.GetType().Name | Should -BeExactly "IshLovValue" + $ishLovValue.GetType().Name | Should-BeString -CaseSensitive "IshLovValue" } It "ishLovValue.IshLovValueRef" { - $ishLovValue.IshLovValueRef -ge 0 | Should -Be $true + $ishLovValue.IshLovValueRef -ge 0 | Should-Be $true } It "ishLovValue.LovId" { - $ishLovValue.LovId | Should -Be "$ishLovId" + $ishLovValue.LovId | Should-Be "$ishLovId" } It "ishLovValue.IshRef" { - $ishLovValue.IshRef | Should -Be $ishLovValueId + $ishLovValue.IshRef | Should-Be $ishLovValueId } It "ishLovValue.Label" { - $ishLovValue.Label -ge 0 | Should -Be $true + $ishLovValue.Label -ge 0 | Should-Be $true } It "ishLovValue.Description" { - $ishLovValue.Description -ge 0 | Should -Be $true + $ishLovValue.Description -ge 0 | Should-Be $true } It "ishLovValue.Active" { - $ishLovValue.Active -ge 0 | Should -Be $true + $ishLovValue.Active -ge 0 | Should-Be $true } } Context "Get-IshLovValue returns two IshLovValue object" { It "Count" { $ishLovValues = Get-IshLovValue -IShSession $ishSession -LovId ($ishLovId,$ishLovId2) -LovValueId ($ishLng,$ishResolution) - $ishLovValues.Count | Should -Be 2 + $ishLovValues.Count | Should-Be 2 } } Context "Get-IshLovValue by LovId returns many IshLovValue objects" { It "Count" { $ishLovValues = Get-IshLovValue -IShSession $ishSession -LovId $ishLovId - $ishLovValues.Count -ge 3 | Should -Be $true + $ishLovValues.Count -ge 3 | Should-Be $true } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/OutputFormat/AddIshOutputFormat.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/OutputFormat/AddIshOutputFormat.Tests.ps1 index d4ebfd2..881e8ac 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/OutputFormat/AddIshOutputFormat.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/OutputFormat/AddIshOutputFormat.Tests.ps1 @@ -9,7 +9,7 @@ BeforeAll { Describe "Add-IshOutputFormat" -Tags "Create" { Context "Add-IshOutputFormat ParameterGroup" { It "Parameter IshSession invalid" { - { Add-IshOutputFormat -IShSession "INVALIDISHSESSION" -Name "INVALIDOUTPUTFORMATNAME" } | Should -Throw + { Add-IshOutputFormat -IShSession "INVALIDISHSESSION" -Name "INVALIDOUTPUTFORMATNAME" } | Should-Throw } } Context "Add-IshOutputFormat ParameterGroup" { @@ -23,9 +23,9 @@ Describe "Add-IshOutputFormat" -Tags "Create" { if (([Version]$ishSession.ServerVersion).Major -ge 13) { $metadata = $metadata | Set-IshMetadataField -IshSession $ishSession -Name "FISHGUIDTOFILENAME" -Level None -ValueType Element -Value "TRUE" } # new mandatory field if (([Version]$ishSession.ServerVersion).Major -ge 14 -or (([Version]$ishSession.ServerVersion).Major -ge 13 -and ([Version]$ishSession.ServerVersion).Revision -ge 2)) { $metadata = $metadata | Set-IshMetadataField -IshSession $ishSession -Name "FISHRESOLUTIONSTOEXPORT" -Level None -ValueType Element -Value "VRESOLUTIONSTOEXPORTALLRESOLUTIONS" } # new mandatory field since 13SP2/13.0.2 $ishObject = Add-IshOutputFormat -IshSession $ishSession -Name $outputFormatName -Metadata $metadata -Edt "EDTZIP" - $ishObject.GetType().Name | Should -BeExactly "IshOutputFormat" - $ishObject.Count | Should -Be 1 - (ConvertTo-Json $ishObject).Length -gt 2 | Should -Be $true + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshOutputFormat" + $ishObject.Count | Should-Be 1 + (ConvertTo-Json $ishObject).Length -gt 2 | Should-Be $true } It "Parameter Metadata" { $outputFormatName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " Metadata") @@ -37,8 +37,8 @@ Describe "Add-IshOutputFormat" -Tags "Create" { if (([Version]$ishSession.ServerVersion).Major -ge 13) { $metadata = $metadata | Set-IshMetadataField -IshSession $ishSession -Name "FISHGUIDTOFILENAME" -Level None -ValueType Element -Value "TRUE" } # new mandatory field if (([Version]$ishSession.ServerVersion).Major -ge 14 -or (([Version]$ishSession.ServerVersion).Major -ge 13 -and ([Version]$ishSession.ServerVersion).Revision -ge 2)) { $metadata = $metadata | Set-IshMetadataField -IshSession $ishSession -Name "FISHRESOLUTIONSTOEXPORT" -Level None -ValueType Element -Value "VRESOLUTIONSTOEXPORTALLRESOLUTIONS" } # new mandatory field since 13SP2/13.0.2 $ishObject = Add-IshOutputFormat -IshSession $ishSession -Name $outputFormatName -Metadata $metadata -Edt "EDTZIP" - $ishObject.Count | Should -Be 1 - $ishObject.IshRef -Like "VOUTPUTFORMAT*" | Should -Be $true + $ishObject.Count | Should-Be 1 + $ishObject.IshRef -Like "VOUTPUTFORMAT*" | Should-Be $true } It "Parameter Metadata return descriptive metadata" { $outputFormatName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " Metadata") @@ -51,10 +51,10 @@ Describe "Add-IshOutputFormat" -Tags "Create" { if (([Version]$ishSession.ServerVersion).Major -ge 13) { $metadata = $metadata | Set-IshMetadataField -IshSession $ishSession -Name "FISHGUIDTOFILENAME" -Level None -ValueType Element -Value "TRUE" } # new mandatory field if (([Version]$ishSession.ServerVersion).Major -ge 14 -or (([Version]$ishSession.ServerVersion).Major -ge 13 -and ([Version]$ishSession.ServerVersion).Revision -ge 2)) { $metadata = $metadata | Set-IshMetadataField -IshSession $ishSession -Name "FISHRESOLUTIONSTOEXPORT" -Level None -ValueType Element -Value "VRESOLUTIONSTOEXPORTALLRESOLUTIONS" } # new mandatory field since 13SP2/13.0.2 $ishObject = Add-IshOutputFormat -IshSession $ishSession -Name $outputFormatName -Metadata $metadata -Edt "EDTZIP" - (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name "FISHOUTPUTFORMATNAME" -Level None).Length -gt 1 | Should -Be $true + (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name "FISHOUTPUTFORMATNAME" -Level None).Length -gt 1 | Should-Be $true } It "Option IshSession.DefaultRequestedMetadata" { - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" $outputFormatName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " Metadata") $metadata = Set-IshMetadataField -IshSession $ishSession -Name "FISHCLEANUP" -Level None -ValueType Element -Value "TRUE" | Set-IshMetadataField -IshSession $ishSession -Name "FISHKEEPDTDSYSTEMID" -Level None -ValueType Element -Value "TRUE" | @@ -65,9 +65,9 @@ Describe "Add-IshOutputFormat" -Tags "Create" { if (([Version]$ishSession.ServerVersion).Major -ge 13) { $metadata = $metadata | Set-IshMetadataField -IshSession $ishSession -Name "FISHGUIDTOFILENAME" -Level None -ValueType Element -Value "TRUE" } # new mandatory field if (([Version]$ishSession.ServerVersion).Major -ge 14 -or (([Version]$ishSession.ServerVersion).Major -ge 13 -and ([Version]$ishSession.ServerVersion).Revision -ge 2)) { $metadata = $metadata | Set-IshMetadataField -IshSession $ishSession -Name "FISHRESOLUTIONSTOEXPORT" -Level None -ValueType Element -Value "VRESOLUTIONSTOEXPORTALLRESOLUTIONS" } # new mandatory field since 13SP2/13.0.2 $ishObject = Add-IshOutputFormat -IshSession $ishSession -Name $outputFormatName -Metadata $metadata -Edt "EDTZIP" - $ishObject.fishoutputformatname.Length -ge 1 | Should -Be $true - $ishObject.fishoutputedt.Length -ge 1 | Should -Be $true - $ishObject.fishoutputedt_none_element | Should -Be "EDTZIP" + $ishObject.fishoutputformatname.Length -ge 1 | Should-Be $true + $ishObject.fishoutputedt.Length -ge 1 | Should-Be $true + $ishObject.fishoutputedt_none_element | Should-Be "EDTZIP" } It "Parameter Metadata StrictMetadataPreference=Off" { $strictMetadataPreference = $ishSession.StrictMetadataPreference @@ -86,7 +86,7 @@ Describe "Add-IshOutputFormat" -Tags "Create" { Set-IshMetadataField -IshSession $ishSession -Name "INVALIDFIELDNAME" -Level None -Value "SomethingInvalidFieldName" if (([Version]$ishSession.ServerVersion).Major -ge 13) { $metadata = $metadata | Set-IshMetadataField -IshSession $ishSession -Name "FISHGUIDTOFILENAME" -Level None -ValueType Element -Value "TRUE" } # new mandatory field if (([Version]$ishSession.ServerVersion).Major -ge 14 -or (([Version]$ishSession.ServerVersion).Major -ge 13 -and ([Version]$ishSession.ServerVersion).Revision -ge 2)) { $metadata = $metadata | Set-IshMetadataField -IshSession $ishSession -Name "FISHRESOLUTIONSTOEXPORT" -Level None -ValueType Element -Value "VRESOLUTIONSTOEXPORTALLRESOLUTIONS" } # new mandatory field since 13SP2/13.0.2 - { Add-IshOutputFormat -IshSession $ishSession -Name $outputFormatName -Metadata $metadata -Edt "EDTZIP" } | Should -Throw + { Add-IshOutputFormat -IshSession $ishSession -Name $outputFormatName -Metadata $metadata -Edt "EDTZIP" } | Should-Throw $ishSession.StrictMetadataPreference = $strictMetadataPreference } } @@ -129,27 +129,27 @@ Describe "Add-IshOutputFormat" -Tags "Create" { Start-Sleep -Milliseconds 1000 # Avoids uniquesness error which only up to the second " Cannot insert duplicate key row in object 'dbo.CARD' with unique index 'CARD_NAME_I1'. The duplicate key value is (VUSERROLEADD-IshOutputFormat20161012164716068A12/10/2016 16:47:16)." } It "Parameter IshObject invalid" { - { Add-IshOutputFormat -IShSession $ishSession -IshObject "INVALIDOUTPUTFORMAT" } | Should -Throw + { Add-IshOutputFormat -IShSession $ishSession -IshObject "INVALIDOUTPUTFORMAT" } | Should-Throw } It "Parameter IshObject Single with optional IshSession" { $ishObjects = Add-IshOutputFormat -IshObject $ishObjectA $ishObjects | Remove-IshOutputFormat - $ishObjects.Count | Should -Be 1 + $ishObjects.Count | Should-Be 1 } It "Parameter IshObject Multiple with optional IshSession" { $ishObjects = Add-IshOutputFormat -IshObject @($ishObjectB,$ishObjectC) $ishObjects | Remove-IshOutputFormat - $ishObjects.Count | Should -Be 2 + $ishObjects.Count | Should-Be 2 } It "Pipeline IshObject Single" { $ishObjects = $ishObjectD | Add-IshOutputFormat -IshSession $ishSession $ishObjects | Remove-IshOutputFormat -IshSession $ishSession - $ishObjects.Count | Should -Be 1 + $ishObjects.Count | Should-Be 1 } It "Pipeline IshObject Multiple" { $ishObjects = @($ishObjectE,$ishObjectF) | Add-IshOutputFormat -IshSession $ishSession $ishObjects | Remove-IshOutputFormat -IshSession $ishSession - $ishObjects.Count | Should -Be 2 + $ishObjects.Count | Should-Be 2 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/PublicationOutput/AddIshPublicationOutput.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/PublicationOutput/AddIshPublicationOutput.Tests.ps1 index 013d3dc..80b8895 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/PublicationOutput/AddIshPublicationOutput.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/PublicationOutput/AddIshPublicationOutput.Tests.ps1 @@ -30,54 +30,54 @@ Describe "Add-IshPublicationOutput" -Tags "Create" { $ishMapMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "All Parameters Map $timestamp" | Set-IshMetadataField -IshSession $ishSession -Name "FAUTHOR" -Level Lng -ValueType Element -Value $ishUserAuthor | Set-IshMetadataField -IshSession $ishSession -Name "FSTATUS" -Level Lng -ValueType Element -Value $ishStatusDraft - $ishObjectMap = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderMap -IshType ISHMasterDoc -LogicalId "MYOWNGENERATEDLOGICALIDMAP" -Version '3' -Lng $ishLng -Metadata $ishMapMetadata -Edt "EDTXML" -FileContent $ditaMapFileContent + $ishObjectMap = Add-IshDocumentObj -IshSession $ishSession -IshFolder $ishFolderMap -IshType ISHMasterDoc -LogicalId "ADDISHPUBLICATIONTOUTPUT-MYOWNGENERATEDLOGICALIDMAP" -Version '3' -Lng $ishLng -Metadata $ishMapMetadata -Edt "EDTXML" -FileContent $ditaMapFileContent $ishFolderPub = Add-IshFolder -IshSession $ishSession -ParentFolderId($global:ishFolderCmdlet.IshFolderRef) -FolderType ISHPublication -FolderName "Pub" -OwnedBy $ownedByTestRootOriginal -ReadAccess $readAccessTestRootOriginal $ishPubMetadata = Set-IshMetadataField -IshSession $ishSession -Name "FTITLE" -Level Logical -Value "All Parameters Pub $timestamp" | Set-IshMetadataField -IshSession $ishSession -Name "FISHMASTERREF" -Level Version -ValueType Element -Value $ishObjectMap.IshRef | Set-IshMetadataField -IshSession $ishSession -Name "FISHPUBSOURCELANGUAGES" -Level Version -ValueType Element -Value $ishLng | Set-IshMetadataField -IshSession $ishSession -Name "FISHREQUIREDRESOLUTIONS" -Level Version -ValueType Element -Value $ishResolution - $ishObjectPub = Add-IshPublicationOutput -IshSession $ishSession -IshFolder $ishFolderPub -LogicalId "MYOWNGENERATEDLOGICALIDPUB" -Version '1' -LanguageCombination $ishLngCombination -OutputFormat $ishOutputFormatDitaXml -Metadata $ishPubMetadata + $ishObjectPub = Add-IshPublicationOutput -IshSession $ishSession -IshFolder $ishFolderPub -LogicalId "ADDISHPUBLICATIONTOUTPUT-MYOWNGENERATEDLOGICALIDPUB" -Version '1' -LanguageCombination $ishLngCombination -OutputFormat $ishOutputFormatDitaXml -Metadata $ishPubMetadata $tempFilePath = (New-TemporaryFile).FullName } Context "Add-IshPublicationOutput returns IshObject object" { It "GetType().Name" { - $ishObjectPub.GetType().Name | Should -BeExactly "IshPublicationOutput" + $ishObjectPub.GetType().Name | Should-BeString -CaseSensitive "IshPublicationOutput" } It "ishObjectPub.IshField" { - $ishObjectPub.IshField | Should -Not -BeNullOrEmpty + $ishObjectPub.IshField | Should-NotBeNull } It "ishObjectPub.IshRef" { - $ishObjectPub.IshRef | Should -Not -BeNullOrEmpty + $ishObjectPub.IshRef | Should-NotBeNull } It "ishObjectPub.IshType" { - $ishObjectPub.IshType | Should -Not -BeNullOrEmpty + $ishObjectPub.IshType | Should-NotBeNull } # Double check following 3 ReferenceType enum usage It "ishObjectPub.ObjectRef" { - $ishObjectPub.ObjectRef | Should -Not -BeNullOrEmpty + $ishObjectPub.ObjectRef | Should-NotBeNull } It "ishObjectPub.VersionRef" { - $ishObjectPub.VersionRef | Should -Not -BeNullOrEmpty + $ishObjectPub.VersionRef | Should-NotBeNull } It "ishObjectPub.LngRef" { - $ishObjectPub.LngRef | Should -Not -BeNullOrEmpty + $ishObjectPub.LngRef | Should-NotBeNull } It "ishObjectPub ConvertTo-Json" { - (ConvertTo-Json $ishObjectPub).Length -gt 2 | Should -Be $true + (ConvertTo-Json $ishObjectPub).Length -gt 2 | Should-Be $true } It "Option IshSession.DefaultRequestedMetadata" { - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" #logical - $ishObjectPub.ftitle_logical_value.Length -ge 1 | Should -Be $true + $ishObjectPub.ftitle_logical_value.Length -ge 1 | Should-Be $true #version - $ishObjectPub.version_version_value.Length -ge 1 | Should -Be $true + $ishObjectPub.version_version_value.Length -ge 1 | Should-Be $true #language - $ishObjectPub.fishpubstatus.Length -ge 1 | Should -Be $true - $ishObjectPub.fishpubstatus_lng_element.StartsWith('VPUBSTATUS') | Should -Be $true - $ishObjectPub.fishpublngcombination.Length -ge 1 | Should -Be $true # Field names like DOC-LANGUAGE get stripped of the hyphen, otherwise you get $ishObject.'doc-language' and now you get the more readable $ishObject.doclanguage - #$ishObjectPub.fishpublngcombination_lng_element.StartsWith('VLANGUAGE') | Should -Be $true # Note that fishpublngcombination is a string like 'en+fr+nl' so doesn't have element name + $ishObjectPub.fishpubstatus.Length -ge 1 | Should-Be $true + $ishObjectPub.fishpubstatus_lng_element.StartsWith('VPUBSTATUS') | Should-Be $true + $ishObjectPub.fishpublngcombination.Length -ge 1 | Should-Be $true # Field names like DOC-LANGUAGE get stripped of the hyphen, otherwise you get $ishObject.'doc-language' and now you get the more readable $ishObject.doclanguage + #$ishObjectPub.fishpublngcombination_lng_element.StartsWith('VLANGUAGE') | Should-Be $true # Note that fishpublngcombination is a string like 'en+fr+nl' so doesn't have element name } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/PublicationOutput/GetPublicationOutputFolderLocation.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/PublicationOutput/GetPublicationOutputFolderLocation.Tests.ps1 index 6652b44..36dfc4b 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/PublicationOutput/GetPublicationOutputFolderLocation.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/PublicationOutput/GetPublicationOutputFolderLocation.Tests.ps1 @@ -33,38 +33,38 @@ Describe "Get-IshPublicationOutputFolderLocation" -Tags "Read" { $folderPath = Get-IshPublicationOutputFolderLocation -IshSession $ishSession -LogicalId $ishObjectPubA.IshRef } It "Parameter IshSession/LogicalId invalid" { - { Get-IshPublicationOutputFolderLocation -IShSession "INVALIDISHSESSION" -LogicalId "INVALIDLOGICALID" } | Should -Throw + { Get-IshPublicationOutputFolderLocation -IShSession "INVALIDISHSESSION" -LogicalId "INVALIDLOGICALID" } | Should-Throw } It "GetType().Name" { - $folderPath.GetType().Name | Should -BeExactly "String" + $folderPath.GetType().Name | Should-BeString -CaseSensitive "String" } It "Parameter LogicalId Single" { - $folderPath | Should -BeExactly (Join-Path (Join-Path $folderTestRootPath $cmdletName) "Publication") + $folderPath | Should-BeString -CaseSensitive (Join-Path (Join-Path $folderTestRootPath $cmdletName) "Publication") } It "Leading IshSession.FolderPathSeparator" { - $folderPath[0] | Should -Be $ishSession.FolderPathSeparator + $folderPath[0] | Should-Be $ishSession.FolderPathSeparator } } Context "Get-IshPublicationOutputFolderLocation IshObjectGroup" { It "GetType().Name" { $folderPathArray = Get-IshPublicationOutputFolderLocation -IshSession $ishSession -IshObject @($ishObjectPubA,$ishObjectPubB) - $folderPathArray.GetType().Name | Should -BeExactly "Object[]" + $folderPathArray.GetType().Name | Should-BeString -CaseSensitive "Object[]" } It "Parameter IshObject Single with implicit IshSession" { $folderPathArray = Get-IshPublicationOutputFolderLocation -IshObject $ishObjectPubA - $folderPathArray.Count | Should -Be 1 + $folderPathArray.Count | Should-Be 1 } It "Parameter IshObject Multiple with implicit IshSession" { $folderPathArray = Get-IshPublicationOutputFolderLocation -IshObject @($ishObjectPubA,$ishObjectPubB) - $folderPathArray.Count | Should -Be 2 + $folderPathArray.Count | Should-Be 2 } It "Pipeline IshObject Single" { $folderPathArray = $ishObjectPubA | Get-IshPublicationOutputFolderLocation -IshSession $ishSession - $folderPathArray.Count | Should -Be 1 + $folderPathArray.Count | Should-Be 1 } It "Pipeline IshObject Multiple" { $folderPathArray = @($ishObjectPubA,$ishObjectPubB) | Get-IshPublicationOutputFolderLocation -IshSession $ishSession - $folderPathArray.Count | Should -Be 2 + $folderPathArray.Count | Should-Be 2 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/PublicationOutput/RemoveIshPublicationOutput.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/PublicationOutput/RemoveIshPublicationOutput.Tests.ps1 index 580ff98..c1beccd 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/PublicationOutput/RemoveIshPublicationOutput.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/PublicationOutput/RemoveIshPublicationOutput.Tests.ps1 @@ -1,4 +1,4 @@ -BeforeAll { +BeforeAll { $cmdletName = "Remove-IshPublicationOutput" Write-Host ("`r`nLoading ISHRemote.PesterSetup.ps1 over BeforeAll-block for MyCommand[" + $cmdletName + "]...") . (Join-Path (Split-Path -Parent $PSCommandPath) "\..\..\ISHRemote.PesterSetup.ps1") @@ -30,28 +30,28 @@ Describe "Remove-IshPublicationOutput" -Tags "Delete" { Context "Remove-IshPublicationOutput check exceptions" { It "-LogicalId does not exist. Force=Yes" { - {Remove-IshPublicationOutput -IshSession $ishSession -LogicalId "NON-EXISTING-LOGICAL-ID" -Version "1" -LanguageCombination $ishLngCombination -OutputFormat $ishOutputFormatDitaXml -Force} | Should -Throw + {Remove-IshPublicationOutput -IshSession $ishSession -LogicalId "NON-EXISTING-LOGICAL-ID" -Version "1" -LanguageCombination $ishLngCombination -OutputFormat $ishOutputFormatDitaXml -Force} | Should-Throw } It "-LogicalId does not exist" { - {Remove-IshPublicationOutput -IshSession $ishSession -LogicalId "NON-EXISTING-LOGICAL-ID" -Version "1" -LanguageCombination $ishLngCombination -OutputFormat $ishOutputFormatDitaXml} | Should -Throw + {Remove-IshPublicationOutput -IshSession $ishSession -LogicalId "NON-EXISTING-LOGICAL-ID" -Version "1" -LanguageCombination $ishLngCombination -OutputFormat $ishOutputFormatDitaXml} | Should-Throw } It "-Version does not exist. Force=Yes" { - {Remove-IshPublicationOutput -IshSession $ishSession -LogicalId $ishObjectPubA.IshRef -Version "999" -LanguageCombination $ishLngCombination -OutputFormat $ishOutputFormatDitaXml -Force} | Should -Throw + {Remove-IshPublicationOutput -IshSession $ishSession -LogicalId $ishObjectPubA.IshRef -Version "999" -LanguageCombination $ishLngCombination -OutputFormat $ishOutputFormatDitaXml -Force} | Should-Throw } It "-Version does not exist" { - {Remove-IshPublicationOutput -IshSession $ishSession -LogicalId $ishObjectPubA.IshRef -Version "999" -LanguageCombination $ishLngCombination -OutputFormat $ishOutputFormatDitaXml} | Should -Throw + {Remove-IshPublicationOutput -IshSession $ishSession -LogicalId $ishObjectPubA.IshRef -Version "999" -LanguageCombination $ishLngCombination -OutputFormat $ishOutputFormatDitaXml} | Should-Throw } It "-LanguageCombination does not exist. Force=Yes" { - {Remove-IshPublicationOutput -IshSession $ishSession -LogicalId $ishObjectPubA.IshRef -Version "1" -LanguageCombination "NON-EXISTING-LANGUAGE-COMBINATION" -OutputFormat $ishOutputFormatDitaXml -Force} | Should -Throw + {Remove-IshPublicationOutput -IshSession $ishSession -LogicalId $ishObjectPubA.IshRef -Version "1" -LanguageCombination "NON-EXISTING-LANGUAGE-COMBINATION" -OutputFormat $ishOutputFormatDitaXml -Force} | Should-Throw } It "-LanguageCombination does not exist" { - {Remove-IshPublicationOutput -IshSession $ishSession -LogicalId $ishObjectPubA.IshRef -Version "1" -LanguageCombination "NON-EXISTING-LANGUAGE-COMBINATION" -OutputFormat $ishOutputFormatDitaXml} | Should -Throw + {Remove-IshPublicationOutput -IshSession $ishSession -LogicalId $ishObjectPubA.IshRef -Version "1" -LanguageCombination "NON-EXISTING-LANGUAGE-COMBINATION" -OutputFormat $ishOutputFormatDitaXml} | Should-Throw } It "-OutputFormat does not exist. Force=Yes" { - {Remove-IshPublicationOutput -IshSession $ishSession -LogicalId $ishObjectPubA.IshRef -Version "999" -LanguageCombination $ishLngCombination -OutputFormat "NON-EXISTING-OUTPUT-FORMAT" -Force} | Should -Throw + {Remove-IshPublicationOutput -IshSession $ishSession -LogicalId $ishObjectPubA.IshRef -Version "999" -LanguageCombination $ishLngCombination -OutputFormat "NON-EXISTING-OUTPUT-FORMAT" -Force} | Should-Throw } It "-OutputFormat does not exist" { - {Remove-IshPublicationOutput -IshSession $ishSession -LogicalId $ishObjectPubA.IshRef -Version "999" -LanguageCombination $ishLngCombination -OutputFormat "NON-EXISTING-OUTPUT-FORMAT"} | Should -Throw + {Remove-IshPublicationOutput -IshSession $ishSession -LogicalId $ishObjectPubA.IshRef -Version "999" -LanguageCombination $ishLngCombination -OutputFormat "NON-EXISTING-OUTPUT-FORMAT"} | Should-Throw } } @@ -62,7 +62,7 @@ Describe "Remove-IshPublicationOutput" -Tags "Delete" { Remove-IshPublicationOutput -IshSession $ishSession -LogicalId $ishPub.IshRef -Version $ishPub.version_version_value -LanguageCombination $ishPub.fishpublngcombination -OutputFormat $ishPub.fishoutputformatref_lng_element -Force $requestedMetadataRetrieve = Set-IshRequestedMetadataField -IshSession $ishSession -Name 'FTITLE' -Level Logical $publicationOutput = Get-IshPublicationOutput -IshSession $ishSession -LogicalId $ishPub.IshRef -RequestedMetadata $requestedMetadataRetrieve - $publicationOutput.length -eq 0 | Should -Be $true + $publicationOutput.length -eq 0 | Should-Be $true } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Session/NewIshSession.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Session/NewIshSession.Tests.ps1 index 672fc9b..a94ab98 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Session/NewIshSession.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Session/NewIshSession.Tests.ps1 @@ -1,4 +1,4 @@ -BeforeAll { +BeforeAll { $cmdletName = "New-IshSession" Write-Host ("`r`nLoading ISHRemote.PesterSetup.ps1 on PSVersion[" + $psversionTable.PSVersion + "] over BeforeAll-block for MyCommand[" + $cmdletName + "]...") . (Join-Path (Split-Path -Parent $PSCommandPath) "\..\..\ISHRemote.PesterSetup.ps1") @@ -10,13 +10,13 @@ Describe "New-IshSession" -Tags "Read" { Context "New-IshSession UserNamePassword so protocol WcfSoapWithWsTrust" { It "Parameter WsBaseUrl invalid" { - { New-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" -IshUserName "INVALIDISHUSERNAME" -IshPassword "INVALIDISHPASSWORD" } | Should -Throw "Invalid URI: The hostname could not be parsed." + { New-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" -IshUserName "INVALIDISHUSERNAME" -IshPassword "INVALIDISHPASSWORD" } | Should-Throw -ExceptionMessage "Invalid URI: The hostname could not be parsed." } It "Parameter IshUserName invalid" { - { New-IshSession -WsBaseUrl $webServicesBaseUrl -IshUserName "INVALIDISHUSERNAME" -IshPassword "INVALIDISHPASSWORD" } | Should -Throw + { New-IshSession -WsBaseUrl $webServicesBaseUrl -IshUserName "INVALIDISHUSERNAME" -IshPassword "INVALIDISHPASSWORD" } | Should-Throw } It "Parameter IshPassword invalid" { - { New-IshSession -WsBaseUrl $webServicesBaseUrl -IshUserName $ishUserName -IshPassword "INVALIDISHPASSWORD" } | Should -Throw + { New-IshSession -WsBaseUrl $webServicesBaseUrl -IshUserName $ishUserName -IshPassword "INVALIDISHPASSWORD" } | Should-Throw } It "Parameter IshUserName empty falls back to NetworkCredential/ActiveDirectory" -Skip:(-Not $isISHRemoteWindowsAuthentication) { { New-IshSession -WsBaseUrl $webServicesBaseUrl -IshUserName "" -IshPassword "IGNOREISHPASSWORD" } | Should -Not -Throw "Cannot validate argument on parameter 'IshUserName'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again." @@ -26,36 +26,36 @@ Describe "New-IshSession" -Tags "Read" { Context "New-IshSession ClientIdClientSecret so protocol WcfSoapWithOpenIdConnect or OpenApiWithOpenIdConnect" { It "Parameter WsBaseUrl invalid" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $exception = { New-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" -ClientId "INVALIDCLIENTID" -ClientSecret "INVALIDCLIENTSECRET" } | Should -Throw -PassThru - $exception -like "*Invalid URI: The hostname could not be parsed.*" | Should -Be $true + $exception = { New-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" -ClientId "INVALIDCLIENTID" -ClientSecret "INVALIDCLIENTSECRET" } | Should-Throw + $exception -like "*Invalid URI: The hostname could not be parsed.*" | Should-Be $true } } It "Parameter ClientId invalid" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $exception = { New-IshSession -WsBaseUrl $webServicesBaseUrl -ClientId "INVALIDCLIENTID" -ClientSecret "INVALIDCLIENTSECRET" } | Should -Throw -PassThru - $exception -like "*invalid_client*" | Should -Be $true + $exception = { New-IshSession -WsBaseUrl $webServicesBaseUrl -ClientId "INVALIDCLIENTID" -ClientSecret "INVALIDCLIENTSECRET" } | Should-Throw + $exception -like "*invalid_client*" | Should-Be $true } } It "Parameter ClientSecret invalid" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $exception = { New-IshSession -WsBaseUrl $webServicesBaseUrl -ClientId $amClientId -ClientSecret "INVALIDCLIENTSECRET" } | Should -Throw -PassThru - $exception -like "*invalid_client*" | Should -Be $true + $exception = { New-IshSession -WsBaseUrl $webServicesBaseUrl -ClientId $amClientId -ClientSecret "INVALIDCLIENTSECRET" } | Should-Throw + $exception -like "*invalid_client*" | Should-Be $true } } It "Parameter ClientSecret expired" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $exception = { New-IshSession -WsBaseUrl $webServicesBaseUrl -ClientId $amClientId -ClientSecret "INVALIDCLIENTSECRETEXPIRED" } | Should -Throw -PassThru - $exception -like "*invalid_client*" | Should -Be $true + $exception = { New-IshSession -WsBaseUrl $webServicesBaseUrl -ClientId $amClientId -ClientSecret "INVALIDCLIENTSECRETEXPIRED" } | Should-Throw + $exception -like "*invalid_client*" | Should-Be $true } } } Context "New-IshSession Interactive so protocol WcfSoapWithWsTrust, WcfSoapWithOpenIdConnect or OpenApiWithOpenIdConnect" { It "Parameter WsBaseUrl invalid" { - { New-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" } | Should -Throw "Invalid URI: The hostname could not be parsed." + { New-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" } | Should-Throw -ExceptionMessage "Invalid URI: The hostname could not be parsed." } It "Parameter WsBaseUrl invalid and -Timeout exists" { - { New-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" -Timeout 5 } | Should -Throw "Invalid URI: The hostname could not be parsed." + { New-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" -Timeout 5 } | Should-Throw -ExceptionMessage "Invalid URI: The hostname could not be parsed." } } @@ -65,12 +65,12 @@ Describe "New-IshSession" -Tags "Read" { $securePassword = ConvertTo-SecureString $ishPassword -AsPlainText -Force $mycredentials = New-Object System.Management.Automation.PSCredential ($ishUserName, $securePassword) New-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" -PSCredential $mycredentials - } | Should -Throw "Invalid URI: The hostname could not be parsed." + } | Should-Throw -ExceptionMessage "Invalid URI: The hostname could not be parsed." } It "Parameter PSCredential invalid" { $securePassword = ConvertTo-SecureString "INVALIDPASSWORD" -AsPlainText -Force $mycredentials = New-Object System.Management.Automation.PSCredential ("INVALIDISHUSERNAME", $securePassword) - { New-IshSession -WsBaseUrl $webServicesBaseUrl -PSCredential $mycredentials } | Should -Throw + { New-IshSession -WsBaseUrl $webServicesBaseUrl -PSCredential $mycredentials } | Should-Throw } It "Parameter PSCredential over WcfSoapWithWsTrust" { if (-not $isLinuxContainerized) { @@ -97,155 +97,155 @@ Describe "New-IshSession" -Tags "Read" { It "Local ISHRemoteSessionStateIshSession" { if (-not $isLinuxContainerized) { $ishSession=$executioncontext.SessionState.PSVariable.GetValue("ISHRemoteSessionStateIshSession") - $ishSession | Should -Not -BeNullOrEmpty - $ishSession.WebServicesBaseUrl | Should -Be $localIShSession.WebServicesBaseUrl - $ishSession.Protocol | Should -Be $localIShSession.Protocol - $ishSession.ServerVersion | Should -Be $localIShSession.ServerVersion - $ishSession.ClientVersion | Should -Be $localIShSession.ClientVersion + $ishSession | Should-NotBeNull + $ishSession.WebServicesBaseUrl | Should-Be $localIShSession.WebServicesBaseUrl + $ishSession.Protocol | Should-Be $localIShSession.Protocol + $ishSession.ServerVersion | Should-Be $localIShSession.ServerVersion + $ishSession.ClientVersion | Should-Be $localIShSession.ClientVersion } } It "Global ISHRemoteSessionStateIshSession" { if (-not $isLinuxContainerized) { $ishSession=$executioncontext.SessionState.PSVariable.GetValue("global:ISHRemoteSessionStateIshSession") - $ishSession | Should -Not -BeNullOrEmpty - $ishSession.WebServicesBaseUrl | Should -Be $localIShSession.WebServicesBaseUrl - $ishSession.Protocol | Should -Be $localIShSession.Protocol - $ishSession.ServerVersion | Should -Be $localIShSession.ServerVersion - $ishSession.ClientVersion | Should -Be $localIShSession.ClientVersion + $ishSession | Should-NotBeNull + $ishSession.WebServicesBaseUrl | Should-Be $localIShSession.WebServicesBaseUrl + $ishSession.Protocol | Should-Be $localIShSession.Protocol + $ishSession.ServerVersion | Should-Be $localIShSession.ServerVersion + $ishSession.ClientVersion | Should-Be $localIShSession.ClientVersion } } It "Protocol" { if (-not $isLinuxContainerized) { - $localIShSession.Protocol | Should -BeExactly "WcfSoapWithWsTrust" + $localIShSession.Protocol | Should-Be "WcfSoapWithWsTrust" } } It "GetType()" { if (-not $isLinuxContainerized) { - $localIShSession.GetType().Name | Should -BeExactly "IshSession" + $localIShSession.GetType().Name | Should-BeString -CaseSensitive "IshSession" } } It "IshSession.AuthenticationContext" { if (-not $isLinuxContainerized) { - $localIShSession.AuthenticationContext | Should -Not -BeNullOrEmpty + $localIShSession.AuthenticationContext | Should-NotBeNull } } It "IshSession.BlobBatchSize" { if (-not $isLinuxContainerized) { - $localIShSession.BlobBatchSize -gt 0 | Should -Be $true + $localIShSession.BlobBatchSize -gt 0 | Should-Be $true } } It "IshSession.ChunkSize" { if (-not $isLinuxContainerized) { - $localIShSession.ChunkSize -gt 0 | Should -Be $true + $localIShSession.ChunkSize -gt 0 | Should-Be $true } } It "IshSession.ClientVersion" { if (-not $isLinuxContainerized) { - $localIShSession.ClientVersion | Should -Not -BeNullOrEmpty + $localIShSession.ClientVersion | Should-NotBeNull } } It "IshSession.ClientVersion not 0.0.0.0" { if (-not $isLinuxContainerized) { - $localIShSession.ClientVersion | Should -Not -Be "0.0.0.0" + $localIShSession.ClientVersion | Should-NotBe "0.0.0.0" } } It "IshSession.FolderPathSeparator" { if (-not $isLinuxContainerized) { - $localIShSession.FolderPathSeparator | Should -Be "\" + $localIShSession.FolderPathSeparator | Should-Be "\" } } It "IshSession.IshUserName" { if (-not $isLinuxContainerized) { - $localIShSession.IshUserName | Should -Not -BeNullOrEmpty + $localIShSession.IshUserName | Should-NotBeNull } } It "IshSession.UserName" { if (-not $isLinuxContainerized) { - $localIShSession.UserName | Should -Not -BeNullOrEmpty + $localIShSession.UserName | Should-NotBeNull } } It "IshSession.ClientAppId" { if (-not $isLinuxContainerized) { - $localIShSession.ClientAppId | Should -Not -BeNullOrEmpty + $localIShSession.ClientAppId | Should-NotBeNull } } It "IshSession.ClientId" { if (-not $isLinuxContainerized) { - $localIShSession.ClientId | Should -BeNullOrEmpty + $localIShSession.ClientId | Should-BeNull } } It "IshSession.AccessToken" { if (-not $isLinuxContainerized) { - $localIShSession.AccessToken | Should -BeNullOrEmpty + $localIShSession.AccessToken | Should-BeEmptyString } } It "IshSession.IshTypeFieldDefinition" { if (-not $isLinuxContainerized) { - $localIShSession.IshTypeFieldDefinition | Should -Not -BeNullOrEmpty + $localIShSession.IshTypeFieldDefinition | Should-NotBeNull } } It "IshSession.IshTypeFieldDefinition.Count" { if (-not $isLinuxContainerized) { - $localIShSession.IshTypeFieldDefinition.Count -gt 460 | Should -Be $true + $localIShSession.IshTypeFieldDefinition.Count -gt 460 | Should-Be $true } } It "IshSession.IshTypeFieldDefinition.GetType().Name" { if (-not $isLinuxContainerized) { - $localIShSession.IshTypeFieldDefinition[0].GetType().Name | Should -BeExactly "IshTypeFieldDefinition" - $localIShSession.IshTypeFieldDefinition[0].ISHType | Should -Not -BeNullOrEmpty - $localIShSession.IshTypeFieldDefinition[0].Level | Should -Not -BeNullOrEmpty - $localIShSession.IshTypeFieldDefinition[0].Name | Should -Not -BeNullOrEmpty - $localIShSession.IshTypeFieldDefinition[0].DataType | Should -Not -BeNullOrEmpty + $localIShSession.IshTypeFieldDefinition[0].GetType().Name | Should-BeString -CaseSensitive "IshTypeFieldDefinition" + $localIShSession.IshTypeFieldDefinition[0].ISHType | Should-NotBeNull + $localIShSession.IshTypeFieldDefinition[0].Level | Should-NotBeNull + $localIShSession.IshTypeFieldDefinition[0].Name | Should-NotBeNull + $localIShSession.IshTypeFieldDefinition[0].DataType | Should-NotBeNull } } It "IshSession.MetadataBatchSize" { if (-not $isLinuxContainerized) { - $localIShSession.MetadataBatchSize -gt 0 | Should -Be $true + $localIShSession.MetadataBatchSize -gt 0 | Should-Be $true } } It "IshSession.Separator" { if (-not $isLinuxContainerized) { - $localIShSession.Separator | Should -Be ", " + $localIShSession.Separator | Should-Be ", " } } It "IshSession.ServerVersion empty (ISHWS down?)" { if (-not $isLinuxContainerized) { - $localIShSession.ServerVersion | Should -Not -BeNullOrEmpty + $localIShSession.ServerVersion | Should-NotBeNull } } It "IshSession.ServerVersion not 0.0.0.0" { if (-not $isLinuxContainerized) { - $localIShSession.ServerVersion | Should -Not -Be "0.0.0.0" + $localIShSession.ServerVersion | Should-NotBe "0.0.0.0" } } It "IshSession.ServerVersion contains 4 dot-seperated parts" { if (-not $isLinuxContainerized) { - $localIShSession.ServerVersion.Split(".").Length | Should -Be 4 + $localIShSession.ServerVersion.Split(".").Length | Should-Be 4 } } It "IshSession.Timeout defaults to 30m" { if (-not $isLinuxContainerized) { - $localIShSession.Timeout.TotalMinutes | Should -Be 30 + $localIShSession.Timeout.TotalMinutes | Should-Be 30 } } It "IshSession.StrictMetadataPreference" { if (-not $isLinuxContainerized) { - $localIShSession.StrictMetadataPreference | Should -Be "Continue" + $localIShSession.StrictMetadataPreference | Should-Be "Continue" } } It "IshSession.PipelineObjectPreference" { if (-not $isLinuxContainerized) { - $localIShSession.PipelineObjectPreference | Should -Be "PSObjectNoteProperty" + $localIShSession.PipelineObjectPreference | Should-Be "PSObjectNoteProperty" } } It "IshSession.DefaultRequestedMetadata" { if (-not $isLinuxContainerized) { - $localIShSession.DefaultRequestedMetadata | Should -Be "Basic" + $localIShSession.DefaultRequestedMetadata | Should-Be "Basic" } } It "IshSession.WebServicesBaseUrl" { if (-not $isLinuxContainerized) { - $localIShSession.WebServicesBaseUrl | Should -Not -BeNullOrEmpty + $localIShSession.WebServicesBaseUrl | Should-NotBeNull } } } @@ -258,152 +258,152 @@ Describe "New-IshSession" -Tags "Read" { } It "Local ISHRemoteSessionStateIshSession" { $ishSession=$executioncontext.SessionState.PSVariable.GetValue("ISHRemoteSessionStateIshSession") - $ishSession | Should -Not -BeNullOrEmpty - $ishSession.WebServicesBaseUrl | Should -Be $localIShSession.WebServicesBaseUrl - $ishSession.Protocol | Should -Be $localIShSession.Protocol - $ishSession.ServerVersion | Should -Be $localIShSession.ServerVersion - $ishSession.ClientVersion | Should -Be $localIShSession.ClientVersion + $ishSession | Should-NotBeNull + $ishSession.WebServicesBaseUrl | Should-Be $localIShSession.WebServicesBaseUrl + $ishSession.Protocol | Should-Be $localIShSession.Protocol + $ishSession.ServerVersion | Should-Be $localIShSession.ServerVersion + $ishSession.ClientVersion | Should-Be $localIShSession.ClientVersion } It "Global ISHRemoteSessionStateIshSession" { $ishSession=$executioncontext.SessionState.PSVariable.GetValue("global:ISHRemoteSessionStateIshSession") - $ishSession | Should -Not -BeNullOrEmpty - $ishSession.WebServicesBaseUrl | Should -Be $localIShSession.WebServicesBaseUrl - $ishSession.Protocol | Should -Be $localIShSession.Protocol - $ishSession.ServerVersion | Should -Be $localIShSession.ServerVersion - $ishSession.ClientVersion | Should -Be $localIShSession.ClientVersion + $ishSession | Should-NotBeNull + $ishSession.WebServicesBaseUrl | Should-Be $localIShSession.WebServicesBaseUrl + $ishSession.Protocol | Should-Be $localIShSession.Protocol + $ishSession.ServerVersion | Should-Be $localIShSession.ServerVersion + $ishSession.ClientVersion | Should-Be $localIShSession.ClientVersion } It "Protocol" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Protocol | Should -BeExactly "WcfSoapWithOpenIdConnect" + $localIShSession.Protocol | Should-Be "WcfSoapWithOpenIdConnect" } } It "GetType()" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.GetType().Name | Should -BeExactly "IshSession" + $localIShSession.GetType().Name | Should-BeString -CaseSensitive "IshSession" } } It "IshSession.AuthenticationContext" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.AuthenticationContext | Should -Not -BeNullOrEmpty + $localIShSession.AuthenticationContext | Should-NotBeNull } } It "IshSession.BlobBatchSize" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.BlobBatchSize -gt 0 | Should -Be $true + $localIShSession.BlobBatchSize -gt 0 | Should-Be $true } } It "IshSession.ChunkSize" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ChunkSize -gt 0 | Should -Be $true + $localIShSession.ChunkSize -gt 0 | Should-Be $true } } It "IshSession.ClientVersion" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ClientVersion | Should -Not -BeNullOrEmpty + $localIShSession.ClientVersion | Should-NotBeNull } } It "IshSession.ClientVersion not 0.0.0.0" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ClientVersion | Should -Not -Be "0.0.0.0" + $localIShSession.ClientVersion | Should-NotBe "0.0.0.0" } } It "IshSession.FolderPathSeparator" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.FolderPathSeparator | Should -Be "\" + $localIShSession.FolderPathSeparator | Should-Be "\" } } It "IshSession.IshUserName" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.IshUserName | Should -Not -BeNullOrEmpty + $localIShSession.IshUserName | Should-NotBeNull } } It "IshSession.UserName" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.UserName | Should -Not -BeNullOrEmpty + $localIShSession.UserName | Should-NotBeNull } } It "IshSession.ClientAppId" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ClientAppId | Should -Not -BeNullOrEmpty + $localIShSession.ClientAppId | Should-NotBeNull } } It "IshSession.ClientId" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ClientId | Should -Not -BeNullOrEmpty + $localIShSession.ClientId | Should-NotBeNull } } It "IshSession.AccessToken" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.AccessToken | Should -Not -BeNullOrEmpty + $localIShSession.AccessToken | Should-NotBeNull } } It "IshSession.IshTypeFieldDefinition" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.IshTypeFieldDefinition | Should -Not -BeNullOrEmpty + $localIShSession.IshTypeFieldDefinition | Should-NotBeNull } } It "IshSession.IshTypeFieldDefinition.Count" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.IshTypeFieldDefinition.Count -gt 460 | Should -Be $true + $localIShSession.IshTypeFieldDefinition.Count -gt 460 | Should-Be $true } } It "IshSession.IshTypeFieldDefinition.GetType().Name" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.IshTypeFieldDefinition[0].GetType().Name | Should -BeExactly "IshTypeFieldDefinition" - $localIShSession.IshTypeFieldDefinition[0].ISHType | Should -Not -BeNullOrEmpty - $localIShSession.IshTypeFieldDefinition[0].Level | Should -Not -BeNullOrEmpty - $localIShSession.IshTypeFieldDefinition[0].Name | Should -Not -BeNullOrEmpty - $localIShSession.IshTypeFieldDefinition[0].DataType | Should -Not -BeNullOrEmpty + $localIShSession.IshTypeFieldDefinition[0].GetType().Name | Should-BeString -CaseSensitive "IshTypeFieldDefinition" + $localIShSession.IshTypeFieldDefinition[0].ISHType | Should-NotBeNull + $localIShSession.IshTypeFieldDefinition[0].Level | Should-NotBeNull + $localIShSession.IshTypeFieldDefinition[0].Name | Should-NotBeNull + $localIShSession.IshTypeFieldDefinition[0].DataType | Should-NotBeNull } } It "IshSession.MetadataBatchSize" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.MetadataBatchSize -gt 0 | Should -Be $true + $localIShSession.MetadataBatchSize -gt 0 | Should-Be $true } } It "IshSession.Separator" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Separator | Should -Be ", " + $localIShSession.Separator | Should-Be ", " } } It "IshSession.ServerVersion empty (ISHWS down?)" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ServerVersion | Should -Not -BeNullOrEmpty + $localIShSession.ServerVersion | Should-NotBeNull } } It "IshSession.ServerVersion not 0.0.0.0" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ServerVersion | Should -Not -Be "0.0.0.0" + $localIShSession.ServerVersion | Should-NotBe "0.0.0.0" } } It "IshSession.ServerVersion contains 4 dot-seperated parts" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ServerVersion.Split(".").Length | Should -Be 4 + $localIShSession.ServerVersion.Split(".").Length | Should-Be 4 } } It "IshSession.Timeout defaults to 30m" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Timeout.TotalMinutes | Should -Be 30 + $localIShSession.Timeout.TotalMinutes | Should-Be 30 } } It "IshSession.StrictMetadataPreference" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.StrictMetadataPreference | Should -Be "Continue" + $localIShSession.StrictMetadataPreference | Should-Be "Continue" } } It "IshSession.PipelineObjectPreference" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.PipelineObjectPreference | Should -Be "PSObjectNoteProperty" + $localIShSession.PipelineObjectPreference | Should-Be "PSObjectNoteProperty" } } It "IshSession.DefaultRequestedMetadata" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.DefaultRequestedMetadata | Should -Be "Basic" + $localIShSession.DefaultRequestedMetadata | Should-Be "Basic" } } It "IshSession.WebServicesBaseUrl" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.WebServicesBaseUrl | Should -Not -BeNullOrEmpty + $localIShSession.WebServicesBaseUrl | Should-NotBeNull } } } @@ -416,152 +416,152 @@ Describe "New-IshSession" -Tags "Read" { } It "Local ISHRemoteSessionStateIshSession" { $ishSession=$executioncontext.SessionState.PSVariable.GetValue("ISHRemoteSessionStateIshSession") - $ishSession | Should -Not -BeNullOrEmpty - $ishSession.WebServicesBaseUrl | Should -Be $localIShSession.WebServicesBaseUrl - $ishSession.Protocol | Should -Be $localIShSession.Protocol - $ishSession.ServerVersion | Should -Be $localIShSession.ServerVersion - $ishSession.ClientVersion | Should -Be $localIShSession.ClientVersion + $ishSession | Should-NotBeNull + $ishSession.WebServicesBaseUrl | Should-Be $localIShSession.WebServicesBaseUrl + $ishSession.Protocol | Should-Be $localIShSession.Protocol + $ishSession.ServerVersion | Should-Be $localIShSession.ServerVersion + $ishSession.ClientVersion | Should-Be $localIShSession.ClientVersion } It "Global ISHRemoteSessionStateIshSession" { $ishSession=$executioncontext.SessionState.PSVariable.GetValue("global:ISHRemoteSessionStateIshSession") - $ishSession | Should -Not -BeNullOrEmpty - $ishSession.WebServicesBaseUrl | Should -Be $localIShSession.WebServicesBaseUrl - $ishSession.Protocol | Should -Be $localIShSession.Protocol - $ishSession.ServerVersion | Should -Be $localIShSession.ServerVersion - $ishSession.ClientVersion | Should -Be $localIShSession.ClientVersion + $ishSession | Should-NotBeNull + $ishSession.WebServicesBaseUrl | Should-Be $localIShSession.WebServicesBaseUrl + $ishSession.Protocol | Should-Be $localIShSession.Protocol + $ishSession.ServerVersion | Should-Be $localIShSession.ServerVersion + $ishSession.ClientVersion | Should-Be $localIShSession.ClientVersion } It "Protocol" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Protocol | Should -BeExactly "OpenApiWithOpenIdConnect" + $localIShSession.Protocol | Should-Be "OpenApiWithOpenIdConnect" } } It "GetType()" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.GetType().Name | Should -BeExactly "IshSession" + $localIShSession.GetType().Name | Should-BeString -CaseSensitive "IshSession" } } It "IshSession.AuthenticationContext" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.AuthenticationContext | Should -Not -BeNullOrEmpty + $localIShSession.AuthenticationContext | Should-NotBeNull } } It "IshSession.BlobBatchSize" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.BlobBatchSize -gt 0 | Should -Be $true + $localIShSession.BlobBatchSize -gt 0 | Should-Be $true } } It "IshSession.ChunkSize" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ChunkSize -gt 0 | Should -Be $true + $localIShSession.ChunkSize -gt 0 | Should-Be $true } } It "IshSession.ClientVersion" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ClientVersion | Should -Not -BeNullOrEmpty + $localIShSession.ClientVersion | Should-NotBeNull } } It "IshSession.ClientVersion not 0.0.0.0" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ClientVersion | Should -Not -Be "0.0.0.0" + $localIShSession.ClientVersion | Should-NotBe "0.0.0.0" } } It "IshSession.FolderPathSeparator" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.FolderPathSeparator | Should -Be "\" + $localIShSession.FolderPathSeparator | Should-Be "\" } } It "IshSession.IshUserName" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.IshUserName | Should -Not -BeNullOrEmpty + $localIShSession.IshUserName | Should-NotBeNull } } It "IshSession.UserName" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.UserName | Should -Not -BeNullOrEmpty + $localIShSession.UserName | Should-NotBeNull } } It "IshSession.ClientAppId" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ClientAppId | Should -Not -BeNullOrEmpty + $localIShSession.ClientAppId | Should-NotBeNull } } It "IshSession.ClientId" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ClientId | Should -Not -BeNullOrEmpty + $localIShSession.ClientId | Should-NotBeNull } } It "IshSession.AccessToken" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.AccessToken | Should -Not -BeNullOrEmpty + $localIShSession.AccessToken | Should-NotBeNull } } It "IshSession.IshTypeFieldDefinition" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.IshTypeFieldDefinition | Should -Not -BeNullOrEmpty + $localIShSession.IshTypeFieldDefinition | Should-NotBeNull } } It "IshSession.IshTypeFieldDefinition.Count" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.IshTypeFieldDefinition.Count -gt 460 | Should -Be $true + $localIShSession.IshTypeFieldDefinition.Count -gt 460 | Should-Be $true } } It "IshSession.IshTypeFieldDefinition.GetType().Name" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.IshTypeFieldDefinition[0].GetType().Name | Should -BeExactly "IshTypeFieldDefinition" - $localIShSession.IshTypeFieldDefinition[0].ISHType | Should -Not -BeNullOrEmpty - $localIShSession.IshTypeFieldDefinition[0].Level | Should -Not -BeNullOrEmpty - $localIShSession.IshTypeFieldDefinition[0].Name | Should -Not -BeNullOrEmpty - $localIShSession.IshTypeFieldDefinition[0].DataType | Should -Not -BeNullOrEmpty + $localIShSession.IshTypeFieldDefinition[0].GetType().Name | Should-BeString -CaseSensitive "IshTypeFieldDefinition" + $localIShSession.IshTypeFieldDefinition[0].ISHType | Should-NotBeNull + $localIShSession.IshTypeFieldDefinition[0].Level | Should-NotBeNull + $localIShSession.IshTypeFieldDefinition[0].Name | Should-NotBeNull + $localIShSession.IshTypeFieldDefinition[0].DataType | Should-NotBeNull } } It "IshSession.MetadataBatchSize" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.MetadataBatchSize -gt 0 | Should -Be $true + $localIShSession.MetadataBatchSize -gt 0 | Should-Be $true } } It "IshSession.Separator" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Separator | Should -Be ", " + $localIShSession.Separator | Should-Be ", " } } It "IshSession.ServerVersion empty (ISHWS down?)" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ServerVersion | Should -Not -BeNullOrEmpty + $localIShSession.ServerVersion | Should-NotBeNull } } It "IshSession.ServerVersion not 0.0.0.0" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ServerVersion | Should -Not -Be "0.0.0.0" + $localIShSession.ServerVersion | Should-NotBe "0.0.0.0" } } It "IshSession.ServerVersion contains 4 dot-seperated parts" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ServerVersion.Split(".").Length | Should -Be 4 + $localIShSession.ServerVersion.Split(".").Length | Should-Be 4 } } It "IshSession.Timeout defaults to 30m" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Timeout.TotalMinutes | Should -Be 30 + $localIShSession.Timeout.TotalMinutes | Should-Be 30 } } It "IshSession.StrictMetadataPreference" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.StrictMetadataPreference | Should -Be "Continue" + $localIShSession.StrictMetadataPreference | Should-Be "Continue" } } It "IshSession.PipelineObjectPreference" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.PipelineObjectPreference | Should -Be "PSObjectNoteProperty" + $localIShSession.PipelineObjectPreference | Should-Be "PSObjectNoteProperty" } } It "IshSession.DefaultRequestedMetadata" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.DefaultRequestedMetadata | Should -Be "Basic" + $localIShSession.DefaultRequestedMetadata | Should-Be "Basic" } } It "IshSession.WebServicesBaseUrl" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.WebServicesBaseUrl | Should -Not -BeNullOrEmpty + $localIShSession.WebServicesBaseUrl | Should-NotBeNull } } } @@ -576,26 +576,26 @@ Describe "New-IshSession" -Tags "Read" { Context "New-IshSession Timeout" { It "Parameter Timeout Invalid" { - { New-IshSession -WsBaseUrl $webServicesBaseUrl -IshUserName $ishUserName -IshPassword $ishPassword -Timeout "INVALIDTIMEOUT" } | Should -Throw + { New-IshSession -WsBaseUrl $webServicesBaseUrl -IshUserName $ishUserName -IshPassword $ishPassword -Timeout "INVALIDTIMEOUT" } | Should-Throw } It "IshSession.Timeout set to 30s" { $localIShSession = New-IshSession -WsBaseUrl $webServicesBaseUrl -ClientId $amClientId -ClientSecret $amClientSecret -Timeout (New-TimeSpan -Seconds 60) -WarningAction Ignore -ErrorAction Ignore - $localIShSession.Timeout.TotalMilliseconds | Should -Be "60000" + $localIShSession.Timeout.TotalMilliseconds | Should-Be "60000" } It "IshSession.Timeout on INVALID url set to 1ms execution" { # TaskCanceledException: A task was canceled. { $invalidWebServicesBaseUrl = $webServicesBaseUrl -replace "://", "://INVALID" New-IshSession -WsBaseUrl $invalidWebServicesBaseUrl -ClientId $amClientId -ClientSecret $amClientSecret -Timeout (New-Object TimeSpan(0,0,0,0,1)) - } | Should -Throw + } | Should-Throw } } Context "New-IshSession IgnoreSslPolicyErrors" { It "Parameter IgnoreSslPolicyErrors specified positive flow" { $localIShSession = New-IshSession -WsBaseUrl $webServicesBaseUrl -ClientId $amClientId -ClientSecret $amClientSecret -IgnoreSslPolicyErrors -WarningAction Ignore - $localIShSession.ServerVersion | Should -Not -BeNullOrEmpty - $localIShSession.ServerVersion.Split(".").Length | Should -Be 4 + $localIShSession.ServerVersion | Should-NotBeNull + $localIShSession.ServerVersion.Split(".").Length | Should-Be 4 } It "Parameter IgnoreSslPolicyErrors specified negative flow like host IPv4 address" { if (-not $isLinuxContainerized) { @@ -613,8 +613,8 @@ Describe "New-IshSession" -Tags "Read" { { $webServicesBaseUrlWithIpAddress = $webServicesBaseUrl.Replace($hostname,$ipv4Address.IPAddressToString) $localIShSession = New-IshSession -WsBaseUrl $webServicesBaseUrlWithIpAddress -IshUserName $ishUserName -IshPassword $ishPassword -IgnoreSslPolicyErrors - $localIShSession.ServerVersion | Should -Not -BeNullOrEmpty - $localIShSession.ServerVersion.Split(".").Length | Should -Be 4 + $localIShSession.ServerVersion | Should-NotBeNull + $localIShSession.ServerVersion.Split(".").Length | Should-Be 4 } # Remember that ipv6 addresses need to go in between square brackets to avoid port confusion } @@ -628,8 +628,8 @@ Describe "New-IshSession" -Tags "Read" { $computername = $hostname.Substring(0,$hostname.IndexOf(".")) $webServicesBaseUrlToComputerName = $webServicesBaseUrl.Replace($hostname,$computername) $localIShSession = New-IshSession -WsBaseUrl $webServicesBaseUrlToComputerName -ClientId $amClientId -ClientSecret $amClientSecret -IgnoreSslPolicyErrors - $localIShSession.ServerVersion | Should -Not -BeNullOrEmpty - $localIShSession.ServerVersion.Split(".").Length | Should -Be 4 + $localIShSession.ServerVersion | Should-NotBeNull + $localIShSession.ServerVersion.Split(".").Length | Should-Be 4 $localIShSession.Dispose() } <# It "Parameter IgnoreSslPolicyErrors specified negative flow (Resolve-DnsName)" -Skip { @@ -641,8 +641,8 @@ Describe "New-IshSession" -Tags "Read" { $ipAddress = Resolve-DnsName –Name $hostname # only available on Windows Server 2012 R2 and Windows 8.1 $webServicesBaseUrlToIpAddress = $webServicesBaseUrl.Replace($hostname,$ipAddress) $localIShSession = New-IshSession -WsBaseUrl $webServicesBaseUrlToIpAddress -ClientId $amClientId -ClientSecret $amClientSecret -IgnoreSslPolicyErrors - $localIShSession.ServerVersion | Should -Not -BeNullOrEmpty - $localIShSession.ServerVersion.Split(".").Length | Should -Be 4 + $localIShSession.ServerVersion | Should-NotBeNull + $localIShSession.ServerVersion.Split(".").Length | Should-Be 4 $localIShSession.Dispose() } #> } @@ -655,107 +655,107 @@ Describe "New-IshSession" -Tags "Read" { } It "IshSession.OpenApiISH30Client" { if ((-not $isLinuxContainerized) -and (([Version]$ishSession.ServerVersion).Major -ge 15)) { # new service since 15/15.0.0 - $localIShSession.OpenApiISH30Client | Should -BeNullOrEmpty + $localIShSession.OpenApiISH30Client | Should-BeNull } } It "IshSession.OpenApiAM10Client" { if ((-not $isLinuxContainerized) -and (([Version]$ishSession.ServerVersion).Major -ge 15)) { # new service since 15/15.0.0 - $localIShSession.OpenApiAM10Client | Should -BeNullOrEmpty + $localIShSession.OpenApiAM10Client | Should-BeNull } } It "IshSession.Annotation25" { if ((-not $isLinuxContainerized) -and (([Version]$ishSession.ServerVersion).Major -ge 14)) { # new service since 14/14.0.0 - $localIShSession.Annotation25 | Should -Not -BeNullOrEmpty + $localIShSession.Annotation25 | Should-NotBeNull } } It "IshSession.Application25" { if (-not $isLinuxContainerized) { - $localIShSession.Application25 | Should -Not -BeNullOrEmpty + $localIShSession.Application25 | Should-NotBeNull } } It "IshSession.BackgroundTask25" { # new service since 13SP2/13.0.2 if (((-not $isLinuxContainerized) -and (([Version]$ishSession.ServerVersion).Major -ge 14 -or (([Version]$ishSession.ServerVersion).Major -ge 13 -and ([Version]$ishSession.ServerVersion).Revision -ge 2)))) { - $localIShSession.BackgroundTask25 | Should -Not -BeNullOrEmpty + $localIShSession.BackgroundTask25 | Should-NotBeNull } } It "IshSession.Baseline25" { if (-not $isLinuxContainerized) { - $localIShSession.Baseline25 | Should -Not -BeNullOrEmpty + $localIShSession.Baseline25 | Should-NotBeNull } } It "IshSession.DocumentObj25" { if (-not $isLinuxContainerized) { - $localIShSession.DocumentObj25 | Should -Not -BeNullOrEmpty + $localIShSession.DocumentObj25 | Should-NotBeNull } } It "IshSession.EDT25" { if (-not $isLinuxContainerized) { - $localIShSession.EDT25 | Should -Not -BeNullOrEmpty + $localIShSession.EDT25 | Should-NotBeNull } } It "IshSession.EventMonitor25" { if (-not $isLinuxContainerized) { - $localIShSession.EventMonitor25 | Should -Not -BeNullOrEmpty + $localIShSession.EventMonitor25 | Should-NotBeNull } } It "IshSession.Folder25" { if (-not $isLinuxContainerized) { - $localIShSession.Folder25 | Should -Not -BeNullOrEmpty + $localIShSession.Folder25 | Should-NotBeNull } } It "IshSession.ListOfValues25" { if (-not $isLinuxContainerized) { - $localIShSession.ListOfValues25 | Should -Not -BeNullOrEmpty + $localIShSession.ListOfValues25 | Should-NotBeNull } } It "IshSession.MetadataBinding25" { if (-not $isLinuxContainerized) { - $localIShSession.MetadataBinding25 | Should -Not -BeNullOrEmpty + $localIShSession.MetadataBinding25 | Should-NotBeNull } } It "IshSession.OutputFormat25" { if (-not $isLinuxContainerized) { - $localIShSession.OutputFormat25 | Should -Not -BeNullOrEmpty + $localIShSession.OutputFormat25 | Should-NotBeNull } } It "IshSession.PublicationOutput25" { if (-not $isLinuxContainerized) { - $localIShSession.PublicationOutput25 | Should -Not -BeNullOrEmpty + $localIShSession.PublicationOutput25 | Should-NotBeNull } } It "IshSession.Search25" { if (-not $isLinuxContainerized) { - $localIShSession.Search25 | Should -Not -BeNullOrEmpty + $localIShSession.Search25 | Should-NotBeNull } } It "IshSession.Settings25" { if (-not $isLinuxContainerized) { - $localIShSession.Settings25 | Should -Not -BeNullOrEmpty + $localIShSession.Settings25 | Should-NotBeNull } } It "IshSession.TranslationJob25" { if (-not $isLinuxContainerized) { - $localIShSession.TranslationJob25 | Should -Not -BeNullOrEmpty + $localIShSession.TranslationJob25 | Should-NotBeNull } } It "IshSession.TranslationTemplate25" { if (-not $isLinuxContainerized) { - $localIShSession.TranslationTemplate25 | Should -Not -BeNullOrEmpty + $localIShSession.TranslationTemplate25 | Should-NotBeNull } } It "IshSession.User25" { if (-not $isLinuxContainerized) { - $localIShSession.User25 | Should -Not -BeNullOrEmpty + $localIShSession.User25 | Should-NotBeNull } } It "IshSession.UserGroup25" { if (-not $isLinuxContainerized) { - $localIShSession.UserGroup25 | Should -Not -BeNullOrEmpty + $localIShSession.UserGroup25 | Should-NotBeNull } } It "IshSession.UserRole25" { if (-not $isLinuxContainerized) { - $localIShSession.UserRole25 | Should -Not -BeNullOrEmpty + $localIShSession.UserRole25 | Should-NotBeNull } } } @@ -769,108 +769,108 @@ Describe "New-IshSession" -Tags "Read" { It "IshSession.OpenApiISH30Client" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 $json = $localIShSession.OpenApiISH30Client.GetApplicationVersionAsync() - $json.Result | Should -Be $ishSession.ServerVersion + $json.Result | Should-Be $ishSession.ServerVersion } } It "IshSession.OpenApiAM10Client" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 $json = $localIShSession.OpenApiAM10Client.IdentityProviders_GetAsync() - $json.Result.Count -ge 1 | Should -Be $true + $json.Result.Count -ge 1 | Should-Be $true } } It "IshSession.Annotation25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Annotation25 | Should -Not -BeNullOrEmpty + $localIShSession.Annotation25 | Should-NotBeNull } } It "IshSession.Application25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Application25 | Should -Not -BeNullOrEmpty + $localIShSession.Application25 | Should-NotBeNull } } It "IshSession.BackgroundTask25" { # new service since 13SP2/13.0.2 if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.BackgroundTask25 | Should -Not -BeNullOrEmpty + $localIShSession.BackgroundTask25 | Should-NotBeNull } } It "IshSession.Baseline25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Baseline25 | Should -Not -BeNullOrEmpty + $localIShSession.Baseline25 | Should-NotBeNull } } It "IshSession.DocumentObj25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.DocumentObj25 | Should -Not -BeNullOrEmpty + $localIShSession.DocumentObj25 | Should-NotBeNull } } It "IshSession.EDT25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.EDT25 | Should -Not -BeNullOrEmpty + $localIShSession.EDT25 | Should-NotBeNull } } It "IshSession.EventMonitor25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.EventMonitor25 | Should -Not -BeNullOrEmpty + $localIShSession.EventMonitor25 | Should-NotBeNull } } It "IshSession.Folder25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Folder25 | Should -Not -BeNullOrEmpty + $localIShSession.Folder25 | Should-NotBeNull } } It "IshSession.ListOfValues25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ListOfValues25 | Should -Not -BeNullOrEmpty + $localIShSession.ListOfValues25 | Should-NotBeNull } } It "IshSession.MetadataBinding25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.MetadataBinding25 | Should -Not -BeNullOrEmpty + $localIShSession.MetadataBinding25 | Should-NotBeNull } } It "IshSession.OutputFormat25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.OutputFormat25 | Should -Not -BeNullOrEmpty + $localIShSession.OutputFormat25 | Should-NotBeNull } } It "IshSession.PublicationOutput25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.PublicationOutput25 | Should -Not -BeNullOrEmpty + $localIShSession.PublicationOutput25 | Should-NotBeNull } } It "IshSession.Search25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Search25 | Should -Not -BeNullOrEmpty + $localIShSession.Search25 | Should-NotBeNull } } It "IshSession.Settings25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Settings25 | Should -Not -BeNullOrEmpty + $localIShSession.Settings25 | Should-NotBeNull } } It "IshSession.TranslationJob25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.TranslationJob25 | Should -Not -BeNullOrEmpty + $localIShSession.TranslationJob25 | Should-NotBeNull } } It "IshSession.TranslationTemplate25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.TranslationTemplate25 | Should -Not -BeNullOrEmpty + $localIShSession.TranslationTemplate25 | Should-NotBeNull } } It "IshSession.User25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.User25 | Should -Not -BeNullOrEmpty + $localIShSession.User25 | Should-NotBeNull } } It "IshSession.UserGroup25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.UserGroup25 | Should -Not -BeNullOrEmpty + $localIShSession.UserGroup25 | Should-NotBeNull } } It "IshSession.UserRole25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.UserRole25 | Should -Not -BeNullOrEmpty + $localIShSession.UserRole25 | Should-NotBeNull } } } @@ -895,20 +895,20 @@ Describe "New-IshSession" -Tags "Read" { It "IshSession.OpenApiISH30Client" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 $json = $localIShSession.OpenApiISH30Client.GetApplicationVersionAsync() - $json.Result | Should -Be $ishSession.ServerVersion + $json.Result | Should-Be $ishSession.ServerVersion } } It "IshSession.OpenApiISH30Client OperationIds (15.1 20240404 methods exists)" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 foreach ($member in $openApiISH30ClientMembers20240404) { - $localIShSession.OpenApiISH30Client.PSObject.Methods.Name | Should -Contain $member + $localIShSession.OpenApiISH30Client.PSObject.Methods.Name | Should-ContainCollection $member } } } It "IshSession.OpenApiISH30Client OperationIds (15.3 20251210 methods exists)" { if ((([Version]$ishSession.ServerVersion).Major -ge 15) -and (([Version]$ishSession.ServerVersion).Minor -ge 2)) { # new service since 15.2/15.2.0 foreach ($member in $openApiISH30ClientMembers20251210) { - $localIShSession.OpenApiISH30Client.PSObject.Methods.Name | Should -Contain $member + $localIShSession.OpenApiISH30Client.PSObject.Methods.Name | Should-ContainCollection $member } } } @@ -916,7 +916,7 @@ Describe "New-IshSession" -Tags "Read" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 foreach ($member in $localIShSession.OpenApiISH30Client.PSObject.Methods.Name) { if ($member -notin @('Equals','GetHashCode','GetType','ToString','get_BaseUrl','set_BaseUrl','get_ReadResponseAsString','set_ReadResponseAsString')) { - $openApiISH30ClientMembers20251210 | Should -Contain $member + $openApiISH30ClientMembers20251210 | Should-ContainCollection $member } } } @@ -924,114 +924,114 @@ Describe "New-IshSession" -Tags "Read" { It "IshSession.OpenApiAM10Client" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 $json = $localIShSession.OpenApiAM10Client.IdentityProviders_GetAsync() - $json.Result.Count -ge 1 | Should -Be $true + $json.Result.Count -ge 1 | Should-Be $true } } It "IshSession.OpenApiAM10Client OperationIds (20240404 methods exists)" { foreach ($member in $openApiAM10ClientMembers20240404) { - $localIShSession.OpenApiAM10Client.PSObject.Methods.Name | Should -Contain $member + $localIShSession.OpenApiAM10Client.PSObject.Methods.Name | Should-ContainCollection $member } } It "IshSession.OpenApiAM10Client OperationIds (new methods found, adapt this test)" { foreach ($member in $localIShSession.OpenApiAM10Client.PSObject.Methods.Name) { if ($member -notin @('Equals','GetHashCode','GetType','ToString','get_BaseUrl','set_BaseUrl','get_ReadResponseAsString','set_ReadResponseAsString')) { - $openApiAM10ClientMembers20240404 | Should -Contain $member + $openApiAM10ClientMembers20240404 | Should-ContainCollection $member } } } It "IshSession.Annotation25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Annotation25 | Should -Not -BeNullOrEmpty + $localIShSession.Annotation25 | Should-NotBeNull } } It "IshSession.Application25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Application25 | Should -Not -BeNullOrEmpty + $localIShSession.Application25 | Should-NotBeNull } } It "IshSession.BackgroundTask25" { # new service since 13SP2/13.0.2 if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.BackgroundTask25 | Should -Not -BeNullOrEmpty + $localIShSession.BackgroundTask25 | Should-NotBeNull } } It "IshSession.Baseline25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Baseline25 | Should -Not -BeNullOrEmpty + $localIShSession.Baseline25 | Should-NotBeNull } } It "IshSession.DocumentObj25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.DocumentObj25 | Should -Not -BeNullOrEmpty + $localIShSession.DocumentObj25 | Should-NotBeNull } } It "IshSession.EDT25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.EDT25 | Should -Not -BeNullOrEmpty + $localIShSession.EDT25 | Should-NotBeNull } } It "IshSession.EventMonitor25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.EventMonitor25 | Should -Not -BeNullOrEmpty + $localIShSession.EventMonitor25 | Should-NotBeNull } } It "IshSession.Folder25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Folder25 | Should -Not -BeNullOrEmpty + $localIShSession.Folder25 | Should-NotBeNull } } It "IshSession.ListOfValues25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.ListOfValues25 | Should -Not -BeNullOrEmpty + $localIShSession.ListOfValues25 | Should-NotBeNull } } It "IshSession.MetadataBinding25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.MetadataBinding25 | Should -Not -BeNullOrEmpty + $localIShSession.MetadataBinding25 | Should-NotBeNull } } It "IshSession.OutputFormat25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.OutputFormat25 | Should -Not -BeNullOrEmpty + $localIShSession.OutputFormat25 | Should-NotBeNull } } It "IshSession.PublicationOutput25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.PublicationOutput25 | Should -Not -BeNullOrEmpty + $localIShSession.PublicationOutput25 | Should-NotBeNull } } It "IshSession.Search25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Search25 | Should -Not -BeNullOrEmpty + $localIShSession.Search25 | Should-NotBeNull } } It "IshSession.Settings25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.Settings25 | Should -Not -BeNullOrEmpty + $localIShSession.Settings25 | Should-NotBeNull } } It "IshSession.TranslationJob25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.TranslationJob25 | Should -Not -BeNullOrEmpty + $localIShSession.TranslationJob25 | Should-NotBeNull } } It "IshSession.TranslationTemplate25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.TranslationTemplate25 | Should -Not -BeNullOrEmpty + $localIShSession.TranslationTemplate25 | Should-NotBeNull } } It "IshSession.User25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.User25 | Should -Not -BeNullOrEmpty + $localIShSession.User25 | Should-NotBeNull } } It "IshSession.UserGroup25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.UserGroup25 | Should -Not -BeNullOrEmpty + $localIShSession.UserGroup25 | Should-NotBeNull } } It "IshSession.UserRole25" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $localIShSession.UserRole25 | Should -Not -BeNullOrEmpty + $localIShSession.UserRole25 | Should-NotBeNull } } } @@ -1039,4 +1039,4 @@ Describe "New-IshSession" -Tags "Read" { AfterAll { Write-Host ("Running "+$cmdletName+" Test Data and Variables cleanup") -} \ No newline at end of file +} diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Session/TestIshSession.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Session/TestIshSession.Tests.ps1 index c8f2653..108c0de 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Session/TestIshSession.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Session/TestIshSession.Tests.ps1 @@ -1,4 +1,4 @@ -BeforeAll { +BeforeAll { $cmdletName = "Test-IshSession" Write-Host ("`r`nLoading ISHRemote.PesterSetup.ps1 on PSVersion[" + $psversionTable.PSVersion + "] over BeforeAll-block for MyCommand[" + $cmdletName + "]...") . (Join-Path (Split-Path -Parent $PSCommandPath) "\..\..\ISHRemote.PesterSetup.ps1") @@ -9,45 +9,45 @@ Describe "Test-IshSession" -Tags "Read" { Context "Test-IshSession UserNamePassword" { It "Parameter WsBaseUrl invalid" { - Test-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" -IshUserName "INVALIDISHUSERNAME" -IshPassword "INVALIDISHPASSWORD" | Should -Be $false + Test-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" -IshUserName "INVALIDISHUSERNAME" -IshPassword "INVALIDISHPASSWORD" | Should-Be $false } It "Parameter IshUserName invalid" { - Test-IshSession -WsBaseUrl $webServicesBaseUrl -IshUserName "INVALIDISHUSERNAME" -IshPassword "INVALIDISHPASSWORD" | Should -Be $false + Test-IshSession -WsBaseUrl $webServicesBaseUrl -IshUserName "INVALIDISHUSERNAME" -IshPassword "INVALIDISHPASSWORD" | Should-Be $false } It "Parameter IshPassword specified" { - Test-IshSession -WsBaseUrl $webServicesBaseUrl -IshUserName $ishUserName -IshPassword "INVALIDISHPASSWORD" | Should -Be $false + Test-IshSession -WsBaseUrl $webServicesBaseUrl -IshUserName $ishUserName -IshPassword "INVALIDISHPASSWORD" | Should-Be $false } } Context "Test-IshSession ClientIdClientSecret so protocol WcfSoapWithOpenIdConnect or OpenApiWithOpenIdConnect" { It "Parameter WsBaseUrl invalid" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - Test-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" | Should -Be $false + Test-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" | Should-Be $false } } It "Parameter ClientId invalid" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - Test-IshSession -WsBaseUrl $webServicesBaseUrl -ClientId "INVALIDCLIENTID" -ClientSecret "INVALIDCLIENTSECRET" | Should -Be $false + Test-IshSession -WsBaseUrl $webServicesBaseUrl -ClientId "INVALIDCLIENTID" -ClientSecret "INVALIDCLIENTSECRET" | Should-Be $false } } It "Parameter ClientSecret invalid" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - Test-IshSession -WsBaseUrl $webServicesBaseUrl -ClientId $amClientId -ClientSecret "INVALIDCLIENTSECRET" | Should -Be $false + Test-IshSession -WsBaseUrl $webServicesBaseUrl -ClientId $amClientId -ClientSecret "INVALIDCLIENTSECRET" | Should-Be $false } } It "Parameter ClientSecret expired" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - Test-IshSession -WsBaseUrl $webServicesBaseUrl -ClientId $amClientId -ClientSecret "INVALIDCLIENTSECRETEXPIRED" | Should -Be $false + Test-IshSession -WsBaseUrl $webServicesBaseUrl -ClientId $amClientId -ClientSecret "INVALIDCLIENTSECRETEXPIRED" | Should-Be $false } } } Context "Test-IshSession Interactive so protocol WcfSoapWithWsTrust, WcfSoapWithOpenIdConnect or OpenApiWithOpenIdConnect" { It "Parameter WsBaseUrl invalid" { - Test-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" | Should -Be $false + Test-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" | Should-Be $false } It "Parameter WsBaseUrl invalid and -Timeout exists" { - Test-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" -Timeout 5 | Should -Be $false + Test-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" -Timeout 5 | Should-Be $false } } @@ -55,25 +55,25 @@ Describe "Test-IshSession" -Tags "Read" { It "Parameter WsBaseUrl invalid" { $securePassword = ConvertTo-SecureString $ishPassword -AsPlainText -Force $mycredentials = New-Object System.Management.Automation.PSCredential ($ishUserName, $securePassword) - Test-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" -PSCredential $mycredentials | Should -Be $false + Test-IshSession -WsBaseUrl "http:///INVALIDWSBASEURL" -PSCredential $mycredentials | Should-Be $false } It "Parameter PSCredential invalid" { $securePassword = ConvertTo-SecureString "INVALIDPASSWORD" -AsPlainText -Force $mycredentials = New-Object System.Management.Automation.PSCredential ("INVALIDISHUSERNAME", $securePassword) - Test-IshSession -WsBaseUrl $webServicesBaseUrl -PSCredential $mycredentials | Should -Be $false + Test-IshSession -WsBaseUrl $webServicesBaseUrl -PSCredential $mycredentials | Should-Be $false } It "Parameter PSCredential over WcfSoapWithWsTrust" { if (-not $isLinuxContainerized) { $securePassword = ConvertTo-SecureString $ishPassword -AsPlainText -Force $mycredentials = New-Object System.Management.Automation.PSCredential ($ishUserName, $securePassword) - Test-IshSession -Protocol WcfSoapWithWsTrust -WsBaseUrl $webServicesBaseUrl -PSCredential $mycredentials | Should -Be $true + Test-IshSession -Protocol WcfSoapWithWsTrust -WsBaseUrl $webServicesBaseUrl -PSCredential $mycredentials | Should-Be $true } } It "Parameter PSCredential over WcfSoapWithOpenIdConnect" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 $secureClientSecret = ConvertTo-SecureString $amClientSecret -AsPlainText -Force $mycredentials = New-Object System.Management.Automation.PSCredential ($amClientId, $secureClientSecret) - Test-IshSession -Protocol WcfSoapWithOpenIdConnect -WsBaseUrl $webServicesBaseUrl -PSCredential $mycredentials | Should -Be $true + Test-IshSession -Protocol WcfSoapWithOpenIdConnect -WsBaseUrl $webServicesBaseUrl -PSCredential $mycredentials | Should-Be $true } } } @@ -83,7 +83,7 @@ Describe "Test-IshSession" -Tags "Read" { $ishSessionResult = Test-IshSession -Protocol WcfSoapWithWsTrust -WsBaseUrl $webServicesBaseUrl -IshUserName $ishUserName -IshPassword $ishPassword } It "GetType()" { - $ishSessionResult.GetType().Name | Should -BeExactly "Boolean" + $ishSessionResult.GetType().Name | Should-BeString -CaseSensitive "Boolean" } } @@ -95,7 +95,7 @@ Describe "Test-IshSession" -Tags "Read" { } It "GetType()" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $ishSessionResult.GetType().Name | Should -BeExactly "Boolean" + $ishSessionResult.GetType().Name | Should-BeString -CaseSensitive "Boolean" } } } @@ -108,7 +108,7 @@ Describe "Test-IshSession" -Tags "Read" { } It "GetType()" { if (([Version]$ishSession.ServerVersion).Major -ge 15) { # new service since 15/15.0.0 - $ishSessionResult.GetType().Name | Should -BeExactly "Boolean" + $ishSessionResult.GetType().Name | Should-BeString -CaseSensitive "Boolean" } } } @@ -117,18 +117,18 @@ Describe "Test-IshSession" -Tags "Read" { It "WsBaseUrl without ending slash" { # .NET throws unhandy "Reference to undeclared entity 'raquo'." error $webServicesBaseUrlWithoutEndingSlash = $webServicesBaseUrl.Substring(0,$webServicesBaseUrl.Length-1) - Test-IshSession -WsBaseUrl $webServicesBaseUrlWithoutEndingSlash -ClientId $amClientId -ClientSecret $amClientSecret | Should -Be $true + Test-IshSession -WsBaseUrl $webServicesBaseUrlWithoutEndingSlash -ClientId $amClientId -ClientSecret $amClientSecret | Should-Be $true } } Context "Test-IshSession Timeout" { It "Parameter Timeout Invalid" { - { Test-IshSession -WsBaseUrl $webServicesBaseUrl -IshUserName $ishUserName -IshPassword $ishPassword -Timeout "INVALIDTIMEOUT" } | Should -Throw + { Test-IshSession -WsBaseUrl $webServicesBaseUrl -IshUserName $ishUserName -IshPassword $ishPassword -Timeout "INVALIDTIMEOUT" } | Should-Throw } It "IshSession.Timeout on INVALID url set to 1ms execution" { # TaskCanceledException: A task was canceled. $invalidWebServicesBaseUrl = $webServicesBaseUrl -replace "://", "://INVALID" - Test-IshSession -WsBaseUrl $invalidWebServicesBaseUrl -IshUserName $ishUserName -IshPassword $ishPassword -Timeout (New-Object TimeSpan(0,0,0,0,1)) | Should -Be $false + Test-IshSession -WsBaseUrl $invalidWebServicesBaseUrl -IshUserName $ishUserName -IshPassword $ishPassword -Timeout (New-Object TimeSpan(0,0,0,0,1)) | Should-Be $false } } @@ -141,7 +141,7 @@ Describe "Test-IshSession" -Tags "Read" { $hostname = $webServicesBaseUrl.Substring($slash2Position+1,$slash3Position-$slash2Position-1) $computername = $hostname.Substring(0,$hostname.IndexOf(".")) $webServicesBaseUrlToComputerName = $webServicesBaseUrl.Replace($hostname,$computername) - Test-IshSession -WsBaseUrl $webServicesBaseUrlToComputerName -IshUserName $ishUserName -IshPassword $ishPassword -IgnoreSslPolicyErrors -WarningAction Ignore | Should -Be $true + Test-IshSession -WsBaseUrl $webServicesBaseUrlToComputerName -IshUserName $ishUserName -IshPassword $ishPassword -IgnoreSslPolicyErrors -WarningAction Ignore | Should-Be $true } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Settings/CompareIshTypeFieldDefinition.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Settings/CompareIshTypeFieldDefinition.Tests.ps1 index 204503e..799e8f3 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Settings/CompareIshTypeFieldDefinition.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Settings/CompareIshTypeFieldDefinition.Tests.ps1 @@ -26,70 +26,70 @@ Describe "Compare-IshTypeFieldDefinition" -Tags "Read" { $ishTypeFieldDefinitionCompares = Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshTypeFieldDefinition $differenceIshTypeFieldDefinitions } It "GetType().Name" { - $ishTypeFieldDefinitionCompares[0].GetType().Name | Should -BeExactly "IshTypeFieldDefinitionCompare" + $ishTypeFieldDefinitionCompares[0].GetType().Name | Should-BeString -CaseSensitive "IshTypeFieldDefinitionCompare" } It "Parameter Left invalid" { - { Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition "INVALIDREFERENCELIST" -RightIshTypeFieldDefinition "INVALIDDIFFERENCELIST" } | Should -Throw + { Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition "INVALIDREFERENCELIST" -RightIshTypeFieldDefinition "INVALIDDIFFERENCELIST" } | Should-Throw } It "Parameter Right invalid" { - { Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshTypeFieldDefinition "INVALIDDIFFERENCELIST" } | Should -Throw + { Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshTypeFieldDefinition "INVALIDDIFFERENCELIST" } | Should-Throw } It "Parameter Left/Right using IncludeIdentical" { $ishTypeFieldDefinitionCompares = Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshTypeFieldDefinition $differenceIshTypeFieldDefinitions -IncludeIdentical - $ishTypeFieldDefinitionCompares.Count | Should -Be 9 + $ishTypeFieldDefinitionCompares.Count | Should-Be 9 } It "Parameter Left/Right" { $ishTypeFieldDefinitionCompares = Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshTypeFieldDefinition $differenceIshTypeFieldDefinitions - $ishTypeFieldDefinitionCompares.Count | Should -Be 7 # =9entries-2equals + $ishTypeFieldDefinitionCompares.Count | Should-Be 7 # =9entries-2equals } It "Parameter Left/Right using ExcludeDifferent" { $ishTypeFieldDefinitionCompares = Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshTypeFieldDefinition $differenceIshTypeFieldDefinitions -ExcludeDifferent - $ishTypeFieldDefinitionCompares.Count | Should -Be 3 # =9entries-2equals-2x2diff + $ishTypeFieldDefinitionCompares.Count | Should-Be 3 # =9entries-2equals-2x2diff } It "Parameter Left/Right using ExcludeDifferent/ExcludeLeftUnique" { $ishTypeFieldDefinitionCompares = Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshTypeFieldDefinition $differenceIshTypeFieldDefinitions -ExcludeDifferent -ExcludeLeftUnique - $ishTypeFieldDefinitionCompares.Count | Should -Be 1 # =9entries-2equals-2x2diff-2left + $ishTypeFieldDefinitionCompares.Count | Should-Be 1 # =9entries-2equals-2x2diff-2left } It "Parameter Left/Right using ExcludeDifferent/ExcludeRightUnique" { $ishTypeFieldDefinitionCompares = Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshTypeFieldDefinition $differenceIshTypeFieldDefinitions -ExcludeDifferent -ExcludeRightUnique - $ishTypeFieldDefinitionCompares.Count | Should -Be 2 # =9entries-2equals-2x2diff-1right + $ishTypeFieldDefinitionCompares.Count | Should-Be 2 # =9entries-2equals-2x2diff-1right } It "Parameter Left/Right using IncludeIdentical/ExcludeDifferent/ExcludeLeftUnique/ExcludeRightUnique" { $ishTypeFieldDefinitionCompares = Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshTypeFieldDefinition $differenceIshTypeFieldDefinitions -IncludeIdentical -ExcludeDifferent -ExcludeLeftUnique -ExcludeRightUnique - $ishTypeFieldDefinitionCompares.Count | Should -Be 2 # =9entries-2x2diff-2left-1right + $ishTypeFieldDefinitionCompares.Count | Should-Be 2 # =9entries-2x2diff-2left-1right } # More tests possible for the IshTypeFieldDefinition properties # Perhaps also test that there CardFields and TableFields present } Context "Compare-IshTypeFieldDefinition using IshSession" { It "Parameter Left invalid" { - { Compare-IshTypeFieldDefinition -LeftIshSession "INVALIDREFERENCEISHSESSION" -RightIshSession "INVALIDDIFFERENCEISHSESSION" } | Should -Throw + { Compare-IshTypeFieldDefinition -LeftIshSession "INVALIDREFERENCEISHSESSION" -RightIshSession "INVALIDDIFFERENCEISHSESSION" } | Should-Throw } It "Parameter Right invalid" { - { Compare-IshTypeFieldDefinition -LeftIshSession $ishSession -RightIshSession "INVALIDDIFFERENCEISHSESSION" } | Should -Throw + { Compare-IshTypeFieldDefinition -LeftIshSession $ishSession -RightIshSession "INVALIDDIFFERENCEISHSESSION" } | Should-Throw } It "Parameter Left/Right same IshSession" { { Compare-IshTypeFieldDefinition -LeftIshSession $ishSession -RightIshSession $ishSession } | Should -Not -Throw } It "Parameter Left/Right same IshSession using IncludeIdentical" { $ishTypeFieldDefinitionCompares = Compare-IshTypeFieldDefinition -LeftIshSession $ishSession -RightIshSession $ishSession -IncludeIdentical - $ishTypeFieldDefinitionCompares.Count -eq $ishSession.IshTypeFieldDefinition.Count | Should -Be $true + $ishTypeFieldDefinitionCompares.Count -eq $ishSession.IshTypeFieldDefinition.Count | Should-Be $true } It "Parameter Left/Right same IshSession using ExcludeDifferent" { $ishTypeFieldDefinitionCompares = Compare-IshTypeFieldDefinition -LeftIshSession $ishSession -RightIshSession $ishSession -ExcludeDifferent - $ishTypeFieldDefinitionCompares.Count | Should -Be 0 + $ishTypeFieldDefinitionCompares.Count | Should-Be 0 } It "Parameter Left/Right same IshSession using ExcludeLeftUnique" { $ishTypeFieldDefinitionCompares = Compare-IshTypeFieldDefinition -LeftIshSession $ishSession -RightIshSession $ishSession -ExcludeLeftUnique - $ishTypeFieldDefinitionCompares.Count | Should -Be 0 + $ishTypeFieldDefinitionCompares.Count | Should-Be 0 } It "Parameter Left/Right same IshSession using IncludeIdentical/ExcludeRightUnique" { $ishTypeFieldDefinitionCompares = Compare-IshTypeFieldDefinition -LeftIshSession $ishSession -RightIshSession $ishSession -IncludeIdentical -ExcludeRightUnique - $ishTypeFieldDefinitionCompares.Count -eq $ishSession.IshTypeFieldDefinition.Count | Should -Be $true + $ishTypeFieldDefinitionCompares.Count -eq $ishSession.IshTypeFieldDefinition.Count | Should-Be $true } It "Parameter Left/Right same IshSession using IncludeIdentical/ExcludeDifferent/ExcludeLeftUnique/ExcludeRightUnique" { $ishTypeFieldDefinitionCompares = Compare-IshTypeFieldDefinition -LeftIshSession $ishSession -RightIshSession $ishSession -IncludeIdentical -ExcludeDifferent -ExcludeLeftUnique -ExcludeRightUnique - $ishTypeFieldDefinitionCompares.Count -eq $ishSession.IshTypeFieldDefinition.Count | Should -Be $true + $ishTypeFieldDefinitionCompares.Count -eq $ishSession.IshTypeFieldDefinition.Count | Should-Be $true } } Context "Compare-IshTypeFieldDefinition mixing IshSession and TriDKXmlSetupFilePath" { @@ -99,46 +99,46 @@ Describe "Compare-IshTypeFieldDefinition" -Tags "Read" { $referenceIshTypeFieldDefinitions = Get-IshTypeFieldDefinition -TriDKXmlSetupFilePath $tempFilePath1 } It "Parameter Left is IshSession and Right is TriDKXmlSetupFilePath" { - (Compare-IshTypeFieldDefinition -LeftIshSession $ishSession -RightIshTypeFieldDefinition $referenceIshTypeFieldDefinitions).Count -ge 460 | Should -Be $true + (Compare-IshTypeFieldDefinition -LeftIshSession $ishSession -RightIshTypeFieldDefinition $referenceIshTypeFieldDefinitions).Count -ge 460 | Should-Be $true } It "Parameter Left is IshSession and Right is TriDKXmlSetupFilePath using ExcludeDifferent" { - (Compare-IshTypeFieldDefinition -LeftIshSession $ishSession -RightIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -ExcludeDifferent).Count -ge 460 | Should -Be $true + (Compare-IshTypeFieldDefinition -LeftIshSession $ishSession -RightIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -ExcludeDifferent).Count -ge 460 | Should-Be $true } It "Parameter Left is TriDKXmlSetupFilePath and Right is IshSession using IncludeIdentical" { - (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -IncludeIdentical).Count -ge 460 | Should -Be $true + (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -IncludeIdentical).Count -ge 460 | Should-Be $true } It "Parameter Left is TriDKXmlSetupFilePath and Right is IshSession using ExcludeDifferent" { - (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -ExcludeDifferent).Count -ge 460 | Should -Be $true + (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -ExcludeDifferent).Count -ge 460 | Should-Be $true } It "Parameter Left is TriDKXmlSetupFilePath and Right is IshSession using ExcludeLeftUnique" { - (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -ExcludeLeftUnique).Count -ge 460 | Should -Be $true + (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -ExcludeLeftUnique).Count -ge 460 | Should-Be $true } if((([Version]$ishSession.ServerVersion).Major -eq 15 -and ([Version]$ishSession.ServerVersion).Minor -ge 1) -or ([Version]$ishSession.ServerVersion).Major -ge 16) { It "Parameter Left is TriDKXmlSetupFilePath and Right is IshSession using ExcludeRightUnique" { - (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -ExcludeRightUnique).Count | Should -Be 9 + (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -ExcludeRightUnique).Count | Should-Be 9 } It "Parameter Left is TriDKXmlSetupFilePath and Right is IshSession using ExcludeLeftUnique/ExcludeRightUnique" { - (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -ExcludeLeftUnique -ExcludeRightUnique).Count | Should -Be 8 + (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -ExcludeLeftUnique -ExcludeRightUnique).Count | Should-Be 8 } It "Parameter Left is TriDKXmlSetupFilePath and Right is IshSession using ExcludeDifferent/ExcludeLeftUnique/ExcludeRightUnique" { - (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -IncludeIdentical -ExcludeDifferent -ExcludeLeftUnique -ExcludeRightUnique).Count | Should -Be 1 + (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -IncludeIdentical -ExcludeDifferent -ExcludeLeftUnique -ExcludeRightUnique).Count | Should-Be 1 } } else { It "Parameter Left is TriDKXmlSetupFilePath and Right is IshSession using ExcludeRightUnique" { - (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -ExcludeRightUnique).Count | Should -Be 9 + (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -ExcludeRightUnique).Count | Should-Be 9 } It "Parameter Left is TriDKXmlSetupFilePath and Right is IshSession using ExcludeLeftUnique/ExcludeRightUnique" { - (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -ExcludeLeftUnique -ExcludeRightUnique).Count | Should -Be 8 + (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -ExcludeLeftUnique -ExcludeRightUnique).Count | Should-Be 8 } It "Parameter Left is TriDKXmlSetupFilePath and Right is IshSession using ExcludeDifferent/ExcludeLeftUnique/ExcludeRightUnique" { - (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -IncludeIdentical -ExcludeDifferent -ExcludeLeftUnique -ExcludeRightUnique).Count | Should -Be 1 + (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -IncludeIdentical -ExcludeDifferent -ExcludeLeftUnique -ExcludeRightUnique).Count | Should-Be 1 } } It "Parameter Left is TriDKXmlSetupFilePath and Right is IshSession using ExcludeDifferent/ExcludeLeftUnique/ExcludeRightUnique" { - (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -ExcludeDifferent -ExcludeLeftUnique -ExcludeRightUnique).Count | Should -Be 0 + (Compare-IshTypeFieldDefinition -LeftIshTypeFieldDefinition $referenceIshTypeFieldDefinitions -RightIshSession $ishSession -ExcludeDifferent -ExcludeLeftUnique -ExcludeRightUnique).Count | Should-Be 0 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Settings/GetIshSetting.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Settings/GetIshSetting.Tests.ps1 index ac498c1..299f5fa 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Settings/GetIshSetting.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Settings/GetIshSetting.Tests.ps1 @@ -9,24 +9,24 @@ BeforeAll { Describe "Get-IshSetting" -Tags "Read" { Context "Get-IshSetting ParameterGroup" { It "Parameter IshSession invalid" { - { Get-IshSetting -IShSession "INVALIDISHSESSION" -FieldName "NAME" -FilePath "INVALIDFILEPATH" } | Should -Throw + { Get-IshSetting -IShSession "INVALIDISHSESSION" -FieldName "NAME" -FilePath "INVALIDFILEPATH" } | Should-Throw } It "Parameter FileName invalid" { - { Get-IshSetting -IShSession $ishSession -FieldName "INVALIDFIELDNAME" -FilePath "INVALIDFILEPATH" } | Should -Throw + { Get-IshSetting -IShSession $ishSession -FieldName "INVALIDFIELDNAME" -FilePath "INVALIDFILEPATH" } | Should-Throw } It "Parameter FilePath invalid" { - { Get-IshSetting -IShSession $ishSession -FieldName "NAME" -FilePath "INVALIDFILEPATH" } | Should -Throw + { Get-IshSetting -IShSession $ishSession -FieldName "NAME" -FilePath "INVALIDFILEPATH" } | Should-Throw } } Context "Get-IshSetting ParameterGroup returns string object" { It "Parameter FieldName" { $fieldValue = Get-IshSetting -IShSession $ishSession -FieldName "NAME" - $fieldValue.GetType().Name | Should -BeExactly "String" - $fieldValue | Should -Be "Configuration card" + $fieldValue.GetType().Name | Should-BeString -CaseSensitive "String" + $fieldValue | Should-Be "Configuration card" } It "Parameter ValueType" { $fieldValue = Get-IshSetting -FieldName FISHSYSTEMRESOLUTION -ValueType Element - $fieldValue.StartsWith('VRES') | Should -Be $true + $fieldValue.StartsWith('VRES') | Should-Be $true } } Context "Get-IshSetting ParameterGroup returns string FileInfo object" { @@ -37,14 +37,14 @@ Describe "Get-IshSetting" -Tags "Read" { $fileInfo = Get-IshSetting -IShSession $ishSession -FieldName "NAME" -FilePath $tempFilePath } It "GetType().Name" { - $fileInfo.GetType().Name | Should -BeExactly "FileInfo" + $fileInfo.GetType().Name | Should-BeString -CaseSensitive "FileInfo" } It "File Exists" { - $fileInfo.FullName -eq $tempFilePath | Should -Be $true - Test-Path -Path $fileInfo.FullName | Should -Be $true + $fileInfo.FullName -eq $tempFilePath | Should-Be $true + Test-Path -Path $fileInfo.FullName | Should-Be $true } It "file NAME is 'Configuration card'" { - (Get-Content $tempFilePath) | Should -Be "Configuration card" + (Get-Content $tempFilePath) | Should-Be "Configuration card" } } Context "Get-IshSetting ParameterGroup Force returns xml FileInfo object" { @@ -56,7 +56,7 @@ Describe "Get-IshSetting" -Tags "Read" { } It "FISHBACKGROUNDTASKCONFIG is xml" { $fileContent = Get-Content $tempFilePath - $fileContent -like " - public abstract class TrisoftCmdlet : PSCmdlet + public abstract class TrisoftCmdlet : PSCmdlet, ILogger { /// /// Sleep constant used to slow down the progress bars to check the messages. @@ -65,8 +65,7 @@ public abstract class TrisoftCmdlet : PSCmdlet protected TrisoftCmdlet() { - Logger = TrisoftCmdletLogger.Instance(); - TrisoftCmdletLogger.Initialize(this); + Logger = this; const int parentActivityId = 1111; //whatever number const int childActivityId = 2222; _parentProgressRecord = new ProgressRecord(parentActivityId, base.GetType().Name, "Processing..."); @@ -76,6 +75,55 @@ protected TrisoftCmdlet() _childProgressRecord.SecondsRemaining = -1; } + // ILogger explicit implementations — route through the PSCmdlet stream methods on this + // instance so logging is always scoped to the runspace that owns this cmdlet. This removes + // the need for the process-wide TrisoftCmdletLogger singleton (see GitHub issue #265). + void ILogger.WriteVerbose(string message) + { + try { WriteVerbose(message); } + catch (Exception) { } + } + + void ILogger.WriteDebug(string message) + { + try { WriteDebug(message); } + catch (Exception) { } + } + + void ILogger.WriteWarning(string message) + { + try { WriteWarning(message); } + catch (Exception) { } + } + + void ILogger.WriteProgress(string activity, string statusDescription, int percentComplete) + { + try + { + var record = new ProgressRecord(3333, activity, statusDescription); + record.PercentComplete = percentComplete; + base.WriteProgress(record); + } + catch (Exception) { } + } + + void ILogger.WriteParentProgress(string activity, string statusDescription, int percentComplete) + { + try + { + var record = new ProgressRecord(4444, activity, statusDescription); + record.PercentComplete = percentComplete; + base.WriteProgress(record); + } + catch (Exception) { } + } + + void ILogger.WriteError(Exception ex, object errorObject) + { + try { WriteError(new ErrorRecord(ex, string.Empty, ErrorCategory.NotSpecified, errorObject)); } + catch (Exception) { } + } + protected override void BeginProcessing() { @@ -190,8 +238,12 @@ public void WriteChildProgress(string message, int current, int total) /// public new void WriteVerbose(string message) { - base.WriteVerbose(base.GetType().Name + " " + message); - WriteDebug(message); + try + { + base.WriteVerbose(base.GetType().Name + " " + message); + WriteDebug(message); + } + catch (Exception) { } } /// @@ -199,7 +251,8 @@ public void WriteChildProgress(string message, int current, int total) /// public new void WriteDebug(string message) { - base.WriteDebug($"{base.GetType().Name} {DateTime.Now.ToString("yyyyMMdd.HHmmss.fff")} {message}"); + try { base.WriteDebug($"{base.GetType().Name} {DateTime.Now.ToString("yyyyMMdd.HHmmss.fff")} {message}"); } + catch (Exception) { } } /// @@ -207,7 +260,8 @@ public void WriteChildProgress(string message, int current, int total) /// public new void WriteWarning(string message) { - base.WriteWarning(base.GetType().Name + " " + message); + try { base.WriteWarning(base.GetType().Name + " " + message); } + catch (Exception) { } } /// diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/TrisoftCmdletLogger.cs b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/TrisoftCmdletLogger.cs deleted file mode 100644 index 6dd3e56..0000000 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/TrisoftCmdletLogger.cs +++ /dev/null @@ -1,198 +0,0 @@ -/* -* Copyright (c) 2014 All Rights Reserved by the SDL Group. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -using Trisoft.ISHRemote.Interfaces; -using System; -using System.Management.Automation; - -namespace Trisoft.ISHRemote.Cmdlets -{ - /// - /// Singleton proxy for single instance of class that provides logging functionality. - /// - /// - public sealed class TrisoftCmdletLogger : ILogger - { - /// - /// The static instance of the class. - /// - private static readonly TrisoftCmdletLogger _instance = new TrisoftCmdletLogger(); - - /// - /// The instance of the class. - /// - private static TrisoftCmdlet _cmdlet; - - /// - /// The progress activity identifier. - /// - private const int ProgressActivityId = 3333; - - /// - /// The parent progress activity identifier. - /// - private const int ParentProgressActivityId = 4444; - - /// - /// The progress record. - /// - private ProgressRecord _progressRecord; - - /// - /// The parent progress record. - /// - private ProgressRecord _parentProgressRecord; - - /// - /// Gets the instance of the instance. - /// - /// Instance of the interface. - public static ILogger Instance() - { - return _instance; - } - - /// - /// Initializes the the instance of the with instance of class. - /// - /// The instance of the class. - public static void Initialize(TrisoftCmdlet cmdlet) - { - _cmdlet = cmdlet; - } - - /// - /// Reports progress. - /// - /// Activity that takes place. - /// Current status description. - /// Complete progress in percent equivalent. - public void WriteProgress(string activity, string statusDescription, int percentComplete = -1) - { - if (_progressRecord == null) - { - _progressRecord = new ProgressRecord(ProgressActivityId, activity, statusDescription); - } - - _progressRecord.ParentActivityId = (_parentProgressRecord != null) ? ParentProgressActivityId : -1; - _progressRecord.Activity = activity; - _progressRecord.StatusDescription = statusDescription; - _progressRecord.PercentComplete = percentComplete; - - try - { - _cmdlet.WriteProgress(_progressRecord); - } - catch (PSInvalidOperationException) - { - //TODO [Should] Make logging work everywhere avoiding PSInvalidOperationException: The WriteObject and WriteError methods cannot be called from outside the overrides of the BeginProcessing, ProcessRecord, and EndProcessing - } - } - - /// - /// Reports progress for parent progress bar. - /// - /// Activity that takes place. - /// Status description. - /// Complete progress in percent equivalent. - public void WriteParentProgress(string activity, string statusDescription, int percentComplete) - { - if (_parentProgressRecord == null) - { - _parentProgressRecord = new ProgressRecord(ParentProgressActivityId, activity, statusDescription); - } - - _parentProgressRecord.Activity = activity; - _parentProgressRecord.StatusDescription = statusDescription; - _parentProgressRecord.PercentComplete = percentComplete; - - try - { - _cmdlet.WriteProgress(_parentProgressRecord); - } - catch (PSInvalidOperationException) - { - //TODO [Should] Make logging work everywhere avoiding PSInvalidOperationException: The WriteObject and WriteError methods cannot be called from outside the overrides of the BeginProcessing, ProcessRecord, and EndProcessing - } - } - - - /// - /// Writes verbose message. - /// - /// Verbose message. - public void WriteVerbose(string message) - { - try - { - _cmdlet.WriteVerbose(message); - } - catch (PSInvalidOperationException) - { - //TODO [Should] Make logging work everywhere avoiding PSInvalidOperationException: The WriteObject and WriteError methods cannot be called from outside the overrides of the BeginProcessing, ProcessRecord, and EndProcessing - } - } - - /// - /// Writes debug-useful information. - /// - /// Debug message. - public void WriteDebug(string message) - { - try - { - _cmdlet.WriteDebug(message); - } - catch (PSInvalidOperationException) - { - //TODO [Should] Make logging work everywhere avoiding PSInvalidOperationException: The WriteObject and WriteError methods cannot be called from outside the overrides of the BeginProcessing, ProcessRecord, and EndProcessing - } - } - - /// - /// Writes warning message. - /// - /// Warning message. - public void WriteWarning(string message) - { - try - { - _cmdlet.WriteWarning(message); - } - catch (PSInvalidOperationException) - { - //TODO [Should] Make logging work everywhere avoiding PSInvalidOperationException: The WriteObject and WriteError methods cannot be called from outside the overrides of the BeginProcessing, ProcessRecord, and EndProcessing - } - } - - /// - /// Writes non-terminating error. - /// - /// Exception as a result of the error. - /// Object that caused error. - public void WriteError(Exception ex, object errorObject = null) - { - try - { - _cmdlet.WriteError(new ErrorRecord(ex, string.Empty, ErrorCategory.NotSpecified, errorObject)); - } - catch (PSInvalidOperationException) - { - //TODO [Should] Make logging work everywhere avoiding PSInvalidOperationException: The WriteObject and WriteError methods cannot be called from outside the overrides of the BeginProcessing, ProcessRecord, and EndProcessing - } - } - } -} diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/User/AddIshUser.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/User/AddIshUser.Tests.ps1 index 88da6cc..ec95836 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/User/AddIshUser.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/User/AddIshUser.Tests.ps1 @@ -9,7 +9,7 @@ BeforeAll { Describe "Add-IshUser" -Tags "Create" { Context "Add-IshUser ParameterGroup" { It "Parameter IshSession invalid" { - { Add-IshUser -IShSession "INVALIDISHSESSION" -Name "INVALIDUSERNAME" } | Should -Throw + { Add-IshUser -IShSession "INVALIDISHSESSION" -Name "INVALIDUSERNAME" } | Should-Throw } } Context "Add-IshUser ParameterGroup" { @@ -19,9 +19,9 @@ Describe "Add-IshUser" -Tags "Create" { Set-IshMetadataField -IshSession $ishSession -Name FUSERGROUP -Level None -ValueType Element -Value "VUSERGROUPDEFAULTDEPARTMENT" | Set-IshMetadataField -IshSession $ishSession -Name PASSWORD -Level None -Value "SomethingSecret" $ishObject = Add-IshUser -IshSession $ishSession -Name $userName -Metadata $metadata - $ishObject.GetType().Name | Should -BeExactly "IshUser" - $ishObject.Count | Should -Be 1 - (ConvertTo-Json $ishObject).Length -gt 2 | Should -Be $true + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshUser" + $ishObject.Count | Should-Be 1 + (ConvertTo-Json $ishObject).Length -gt 2 | Should-Be $true } It "Parameter Metadata" { $userName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " Metadata") @@ -29,8 +29,8 @@ Describe "Add-IshUser" -Tags "Create" { Set-IshMetadataField -IshSession $ishSession -Name FUSERGROUP -Level None -ValueType Element -Value "VUSERGROUPDEFAULTDEPARTMENT" | Set-IshMetadataField -IshSession $ishSession -Name PASSWORD -Level None -Value "SomethingSecret" $ishObject = Add-IshUser -IshSession $ishSession -Name $userName -Metadata $metadata - $ishObject.Count | Should -Be 1 - $ishObject.IshRef -Like "VUSER*" | Should -Be $true + $ishObject.Count | Should-Be 1 + $ishObject.IshRef -Like "VUSER*" | Should-Be $true } It "Parameter Metadata return descriptive metadata" { $userName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " Metadata") @@ -38,15 +38,15 @@ Describe "Add-IshUser" -Tags "Create" { Set-IshMetadataField -IshSession $ishSession -Name FUSERGROUP -Level None -ValueType Element -Value "VUSERGROUPDEFAULTDEPARTMENT" | Set-IshMetadataField -IshSession $ishSession -Name PASSWORD -Level None -Value "SomethingSecret" $ishObject = Add-IshUser -IshSession $ishSession -Name $userName -Metadata $metadata - (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name FISHUSERLANGUAGE -Level None -ValueType Element).Length -gt 1 | Should -Be $true # added user field by element name - (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name FISHUSERLANGUAGE -Level None -ValueType Value).Length -gt 1 | Should -Be $true # added user field by element name, value added by AddDescriptiveFields - (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name FUSERGROUP -Level None -ValueType Element).Length -gt 1 | Should -Be $true # added user field by element name - (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name FUSERGROUP -Level None -ValueType Value).Length -gt 1 | Should -Be $true # added user field by element name, value added by AddDescriptiveFields - (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name USERNAME -Level None).Length -gt 1 | Should -Be $true - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" - $ishObject.username.Length -ge 1 | Should -Be $true - $ishObject.fishusertype.Length -ge 1 | Should -Be $true - $ishObject.fishusertype_none_element.StartsWith('VUSERTYPE') | Should -Be $true + (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name FISHUSERLANGUAGE -Level None -ValueType Element).Length -gt 1 | Should-Be $true # added user field by element name + (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name FISHUSERLANGUAGE -Level None -ValueType Value).Length -gt 1 | Should-Be $true # added user field by element name, value added by AddDescriptiveFields + (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name FUSERGROUP -Level None -ValueType Element).Length -gt 1 | Should-Be $true # added user field by element name + (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name FUSERGROUP -Level None -ValueType Value).Length -gt 1 | Should-Be $true # added user field by element name, value added by AddDescriptiveFields + (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name USERNAME -Level None).Length -gt 1 | Should-Be $true + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" + $ishObject.username.Length -ge 1 | Should-Be $true + $ishObject.fishusertype.Length -ge 1 | Should-Be $true + $ishObject.fishusertype_none_element.StartsWith('VUSERTYPE') | Should-Be $true } It "Parameter Metadata StrictMetadataPreference=Off with INVALIDFIELDNAME" { $strictMetadataPreference = $ishSession.StrictMetadataPreference @@ -60,7 +60,7 @@ Describe "Add-IshUser" -Tags "Create" { Set-IshMetadataField -IshSession $ishSession -Name "READ-ACCESS" -Level None -Value "SomethingReadAccess" | Set-IshMetadataField -IshSession $ishSession -Name "OWNER" -Level None -Value "SomethingOwner" | Set-IshMetadataField -IshSession $ishSession -Name "INVALIDFIELDNAME" -Level None -Value "SomethingInvalidFieldName" - { Add-IshUser -IshSession $ishSession -Name $userName -Metadata $metadata } | Should -Throw + { Add-IshUser -IshSession $ishSession -Name $userName -Metadata $metadata } | Should-Throw $ishSession.StrictMetadataPreference = $strictMetadataPreference } It "Parameter Metadata StrictMetadataPreference=Continue with many system fields" { @@ -116,7 +116,7 @@ Describe "Add-IshUser" -Tags "Create" { Set-IshMetadataField -IshSession $ishSession -Name "FISHPASSWORDHISTORY" -Level None -Value "NoHistory" | # RemoveSystemFields always removed upon Create since Kojak/13.0.0 Set-IshMetadataField -IshSession $ishSession -Name "FISHFAILEDATTEMPTS" -Level None -Value "10" # RemoveSystemFields always removed upon Create since Kojak/13.0.0 } - { Add-IshUser -IshSession $ishSession -Name $userName -Metadata $metadata } | Should -Throw + { Add-IshUser -IshSession $ishSession -Name $userName -Metadata $metadata } | Should-Throw $ishSession.StrictMetadataPreference = $strictMetadataPreference } } @@ -141,33 +141,33 @@ Describe "Add-IshUser" -Tags "Create" { Start-Sleep -Milliseconds 1000 # Avoids uniquesness error which only up to the second " Cannot insert duplicate key row in object 'dbo.CARD' with unique index 'CARD_NAME_I1'. The duplicate key value is (VUSERADD-ISHUSER20161012164716068A12/10/2016 16:47:16)." } It "Parameter IshObject invalid" { - { Add-IshUser -IShSession $ishSession -IshObject "INVALIDUSER" } | Should -Throw + { Add-IshUser -IShSession $ishSession -IshObject "INVALIDUSER" } | Should-Throw } It "Parameter IshObject Single with implicit IshSession" { $ishObjectA = $ishObjectA | Set-IshMetadataField -Name PASSWORD -Level None -Value "PasswordNotPutOnThePipeline" $ishObjects = Add-IshUser -IshObject $ishObjectA $ishObjects | Remove-IshUser - $ishObjects.Count | Should -Be 1 + $ishObjects.Count | Should-Be 1 } It "Parameter IshObject Multiple with implicit IshSession" { $ishObjectB = $ishObjectB | Set-IshMetadataField -Name PASSWORD -Level None -Value "PasswordNotPutOnThePipeline" $ishObjectC = $ishObjectC | Set-IshMetadataField -Name PASSWORD -Level None -Value "PasswordNotPutOnThePipeline" $ishObjects = Add-IshUser -IshObject @($ishObjectB,$ishObjectC) $ishObjects | Remove-IshUser - $ishObjects.Count | Should -Be 2 + $ishObjects.Count | Should-Be 2 } It "Pipeline IshObject Single" { $ishObjectD = $ishObjectD | Set-IshMetadataField -IshSession $ishSession -Name PASSWORD -Level None -Value "PasswordNotPutOnThePipeline" $ishObjects = $ishObjectD | Add-IshUser -IshSession $ishSession $ishObjects | Remove-IshUser -IshSession $ishSession - $ishObjects.Count | Should -Be 1 + $ishObjects.Count | Should-Be 1 } It "Pipeline IshObject Multiple" { $ishObjectE = $ishObjectE | Set-IshMetadataField -IshSession $ishSession -Name PASSWORD -Level None -Value "PasswordNotPutOnThePipeline" $ishObjectF = $ishObjectF | Set-IshMetadataField -IshSession $ishSession -Name PASSWORD -Level None -Value "PasswordNotPutOnThePipeline" $ishObjects = @($ishObjectE,$ishObjectF) | Add-IshUser -IshSession $ishSession $ishObjects | Remove-IshUser -IshSession $ishSession - $ishObjects.Count | Should -Be 2 + $ishObjects.Count | Should-Be 2 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/User/GetIshUser.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/User/GetIshUser.Tests.ps1 index 6f38886..7a50b1d 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/User/GetIshUser.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/User/GetIshUser.Tests.ps1 @@ -9,7 +9,7 @@ BeforeAll { Describe "Get-IshUser" -Tags "Create" { Context "Get-IshUser ParameterGroup" { It "Parameter IshSession invalid" { - { Get-IshUser -IShSession "INVALIDISHSESSION" -Name "INVALIDUSERNAME" } | Should -Throw + { Get-IshUser -IShSession "INVALIDISHSESSION" -Name "INVALIDUSERNAME" } | Should-Throw } } Context "Get-IshUser ParameterGroup" { @@ -22,14 +22,14 @@ Describe "Get-IshUser" -Tags "Create" { } It "Parameter IshSession Implicit" { $ishObject = Get-IshUser -Id $ishObject.IshRef - $ishObject.GetType().Name | Should -BeExactly "IshUser" - $ishObject.Count | Should -Be 1 + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshUser" + $ishObject.Count | Should-Be 1 } It "Parameter Metadata StrictMetadataPreference=Off with PASSWORD" { $strictMetadataPreference = $ishSession.StrictMetadataPreference $requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name PASSWORD -Level None $ishSession.StrictMetadataPreference = "Off" - { Get-IshUser -IshSession $ishSession -Id $ishObject.IshRef -RequestedMetadata $requestedMetadata } | Should -Throw + { Get-IshUser -IshSession $ishSession -Id $ishObject.IshRef -RequestedMetadata $requestedMetadata } | Should-Throw $ishSession.StrictMetadataPreference = "Continue" { Get-IshUser -IshSession $ishSession -Id $ishObject.IshRef -RequestedMetadata $requestedMetadata } | Should -Not -Throw $ishSession.StrictMetadataPreference = $strictMetadataPreference @@ -46,20 +46,20 @@ Describe "Get-IshUser" -Tags "Create" { $ishSession.DefaultRequestedMetadata = "Descriptive" $ishObject = Get-IshUser -IshSession $ishSession $ishSession.DefaultRequestedMetadata = $oldDefaultRequestedMetadata - $ishObject.GetType().Name | Should -BeExactly "IshUser" - $ishObject.IshField.Length | Should -Be 10 + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshUser" + $ishObject.IshField.Length | Should-Be 10 } It "Parameter IshSession.DefaultRequestedMetadata=Basic on My-Metadata" { $oldDefaultRequestedMetadata = $ishSession.DefaultRequestedMetadata $ishSession.DefaultRequestedMetadata = "Basic" $ishObject = Get-IshUser -IshSession $ishSession $ishSession.DefaultRequestedMetadata = $oldDefaultRequestedMetadata - $ishObject.GetType().Name | Should -BeExactly "IshUser" + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshUser" if((([Version]$ishSession.ServerVersion).Major -eq 15 -and ([Version]$ishSession.ServerVersion).Minor -ge 1) -or ([Version]$ishSession.ServerVersion).Major -ge 16) { - $ishObject.IshField.Length | Should -Be 27 + $ishObject.IshField.Length | Should-Be 27 } else { - $ishObject.IshField.Length | Should -Be 25 + $ishObject.IshField.Length | Should-Be 25 } } It "Parameter IshSession.DefaultRequestedMetadata=All on My-Metadata" { @@ -67,8 +67,8 @@ Describe "Get-IshUser" -Tags "Create" { $ishSession.DefaultRequestedMetadata = "All" $ishObject = Get-IshUser -IshSession $ishSession $ishSession.DefaultRequestedMetadata = $oldDefaultRequestedMetadata - $ishObject.GetType().Name | Should -BeExactly "IshUser" - $ishObject.IshField.Length | Should -Be 29 + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshUser" + $ishObject.IshField.Length | Should-Be 29 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/UserGroup/AddIshUserGroup.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/UserGroup/AddIshUserGroup.Tests.ps1 index 4f19578..2189691 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/UserGroup/AddIshUserGroup.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/UserGroup/AddIshUserGroup.Tests.ps1 @@ -9,34 +9,34 @@ BeforeAll { Describe "Add-IshUserGroup" -Tags "Create" { Context "Add-IshUserGroup ParameterGroup" { It "Parameter IshSession invalid" { - { Add-IshUserGroup -IShSession "INVALIDISHSESSION" -Name "INVALIDUSERGROUPNAME" } | Should -Throw + { Add-IshUserGroup -IShSession "INVALIDISHSESSION" -Name "INVALIDUSERGROUPNAME" } | Should-Throw } } Context "Add-IshUserGroup ParameterGroup" { It "GetType().Name" { $userGroupName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " Name") $ishObject = Add-IshUserGroup -IshSession $ishSession -Name $userGroupName - $ishObject.GetType().Name | Should -BeExactly "IshUserGroup" - $ishObject.Count | Should -Be 1 - (ConvertTo-Json $ishObject).Length -gt 2 | Should -Be $true + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshUserGroup" + $ishObject.Count | Should-Be 1 + (ConvertTo-Json $ishObject).Length -gt 2 | Should-Be $true } It "Parameter Metadata" { $userGroupName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " Metadata") $metadata = Set-IshMetadataField -IshSession $ishSession -Name "FDESCRIPTION" -Level None -Value "Description of $userGroupName" $ishObject = Add-IshUserGroup -IshSession $ishSession -Name $userGroupName -Metadata $metadata - $ishObject.Count | Should -Be 1 - $ishObject.IshRef -Like "VUSER*" | Should -Be $true + $ishObject.Count | Should-Be 1 + $ishObject.IshRef -Like "VUSER*" | Should-Be $true } It "Parameter Metadata return descriptive metadata" { $userGroupName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " Metadata") $metadata = Set-IshMetadataField -IshSession $ishSession -Name "FDESCRIPTION" -Level None -Value "Description of $userGroupName" $ishObject = Add-IshUserGroup -IshSession $ishSession -Name $userGroupName -Metadata $metadata - (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name FDESCRIPTION -Level None).Length -gt 1 | Should -Be $true - (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name FISHUSERGROUPNAME -Level None).Length -gt 1 | Should -Be $true - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" - $ishObject.fishobjectactive.Length -ge 1 | Should -Be $true - $ishObject.fishusergroupname.Length -ge 1 | Should -Be $true - $ishObject.fishusergroupname_none_element.StartsWith('VUSERGROUP') | Should -Be $true + (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name FDESCRIPTION -Level None).Length -gt 1 | Should-Be $true + (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name FISHUSERGROUPNAME -Level None).Length -gt 1 | Should-Be $true + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" + $ishObject.fishobjectactive.Length -ge 1 | Should-Be $true + $ishObject.fishusergroupname.Length -ge 1 | Should-Be $true + $ishObject.fishusergroupname_none_element.StartsWith('VUSERGROUP') | Should-Be $true } It "Parameter Metadata StrictMetadataPreference=Off" { $strictMetadataPreference = $ishSession.StrictMetadataPreference @@ -47,7 +47,7 @@ Describe "Add-IshUserGroup" -Tags "Create" { Set-IshMetadataField -IshSession $ishSession -Name "READ-ACCESS" -Level None -Value "SomethingReadAccess" | Set-IshMetadataField -IshSession $ishSession -Name "OWNER" -Level None -Value "SomethingOwner" | Set-IshMetadataField -IshSession $ishSession -Name "INVALIDFIELDNAME" -Level None -Value "SomethingInvalidFieldName" - { Add-IshUserGroup -IshSession $ishSession -Name $userGroupName -Metadata $metadata } | Should -Throw + { Add-IshUserGroup -IshSession $ishSession -Name $userGroupName -Metadata $metadata } | Should-Throw $ishSession.StrictMetadataPreference = $strictMetadataPreference } } @@ -73,27 +73,27 @@ Describe "Add-IshUserGroup" -Tags "Create" { Start-Sleep -Milliseconds 1000 # Avoids uniquesness error which only up to the second " Cannot insert duplicate key row in object 'dbo.CARD' with unique index 'CARD_NAME_I1'. The duplicate key value is (...A12/10/2016 16:47:16)." } It "Parameter IshObject invalid" { - { Add-IshUserGroup -IShSession $ishSession -IshObject "INVALIDUSERGROUP" } | Should -Throw + { Add-IshUserGroup -IShSession $ishSession -IshObject "INVALIDUSERGROUP" } | Should-Throw } It "Parameter IshObject Single with implicit IshSession" { $ishObjects = Add-IshUserGroup -IshObject $ishObjectA $ishObjects | Remove-IshUserGroup - $ishObjects.Count | Should -Be 1 + $ishObjects.Count | Should-Be 1 } It "Parameter IshObject Multiple with implicit IshSession" { $ishObjects = Add-IshUserGroup -IshObject @($ishObjectB,$ishObjectC) $ishObjects | Remove-IshUserGroup - $ishObjects.Count | Should -Be 2 + $ishObjects.Count | Should-Be 2 } It "Pipeline IshObject Single" { $ishObjects = $ishObjectD | Add-IshUserGroup -IshSession $ishSession $ishObjects | Remove-IshUserGroup -IshSession $ishSession - $ishObjects.Count | Should -Be 1 + $ishObjects.Count | Should-Be 1 } It "Pipeline IshObject Multiple" { $ishObjects = @($ishObjectE,$ishObjectF) | Add-IshUserGroup -IshSession $ishSession $ishObjects | Remove-IshUserGroup -IshSession $ishSession - $ishObjects.Count | Should -Be 2 + $ishObjects.Count | Should-Be 2 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/UserRole/AddIshUserRole.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/UserRole/AddIshUserRole.Tests.ps1 index dbed2d0..967c635 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/UserRole/AddIshUserRole.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/UserRole/AddIshUserRole.Tests.ps1 @@ -9,34 +9,34 @@ BeforeAll { Describe "Add-IshUserRole" -Tags "Create" { Context "Add-IshUserRole ParameterGroup" { It "Parameter IshSession invalid" { - { Add-IshUserRole -IShSession "INVALIDISHSESSION" -Name "INVALIDUSERROLENAME" } | Should -Throw + { Add-IshUserRole -IShSession "INVALIDISHSESSION" -Name "INVALIDUSERROLENAME" } | Should-Throw } } Context "Add-IshUserRole ParameterGroup" { It "GetType().Name" { $userRoleName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " Name") $ishObject = Add-IshUserRole -IshSession $ishSession -Name $userRoleName - $ishObject.GetType().Name | Should -BeExactly "IshUserRole" - $ishObject.Count | Should -Be 1 - (ConvertTo-Json $ishObject).Length -gt 2 | Should -Be $true + $ishObject.GetType().Name | Should-BeString -CaseSensitive "IshUserRole" + $ishObject.Count | Should-Be 1 + (ConvertTo-Json $ishObject).Length -gt 2 | Should-Be $true } It "Parameter Metadata" { $userRoleName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " Metadata") $metadata = Set-IshMetadataField -IshSession $ishSession -Name "FDESCRIPTION" -Level None -Value "Description of $userRoleName" $ishObject = Add-IshUserRole -IshSession $ishSession -Name $userRoleName -Metadata $metadata - $ishObject.Count | Should -Be 1 - $ishObject.IshRef -Like "VUSER*" | Should -Be $true + $ishObject.Count | Should-Be 1 + $ishObject.IshRef -Like "VUSER*" | Should-Be $true } It "Parameter Metadata return descriptive metadata" { $userRoleName = ($cmdletName + " " + (Get-Date -Format "yyyyMMddHHmmssfff") + " Metadata") $metadata = Set-IshMetadataField -IshSession $ishSession -Name "FDESCRIPTION" -Level None -Value "Description of $userRoleName" $ishObject = Add-IshUserRole -IshSession $ishSession -Name $userRoleName -Metadata $metadata - (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name FDESCRIPTION -Level None).Length -gt 1 | Should -Be $true - (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name FISHUSERROLENAME -Level None).Length -gt 1 | Should -Be $true - $ishSession.DefaultRequestedMetadata | Should -Be "Basic" - $ishObject.fishobjectactive.Length -ge 1 | Should -Be $true - $ishObject.fishuserrolename.Length -ge 1 | Should -Be $true - $ishObject.fishuserrolename_none_element.StartsWith('VUSERROLE') | Should -Be $true + (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name FDESCRIPTION -Level None).Length -gt 1 | Should-Be $true + (Get-IshMetadataField -IshSession $ishSession -IshObject $ishObject -Name FISHUSERROLENAME -Level None).Length -gt 1 | Should-Be $true + $ishSession.DefaultRequestedMetadata | Should-Be "Basic" + $ishObject.fishobjectactive.Length -ge 1 | Should-Be $true + $ishObject.fishuserrolename.Length -ge 1 | Should-Be $true + $ishObject.fishuserrolename_none_element.StartsWith('VUSERROLE') | Should-Be $true } It "Parameter Metadata StrictMetadataPreference=Off" { $strictMetadataPreference = $ishSession.StrictMetadataPreference @@ -47,7 +47,7 @@ Describe "Add-IshUserRole" -Tags "Create" { Set-IshMetadataField -IshSession $ishSession -Name "READ-ACCESS" -Level None -Value "SomethingReadAccess" | Set-IshMetadataField -IshSession $ishSession -Name "OWNER" -Level None -Value "SomethingOwner" | Set-IshMetadataField -IshSession $ishSession -Name "INVALIDFIELDNAME" -Level None -Value "SomethingInvalidFieldName" - { Add-IshUserRole -IshSession $ishSession -Name $userRoleName -Metadata $metadata } | Should -Throw + { Add-IshUserRole -IshSession $ishSession -Name $userRoleName -Metadata $metadata } | Should-Throw $ishSession.StrictMetadataPreference = $strictMetadataPreference } } @@ -72,27 +72,27 @@ Describe "Add-IshUserRole" -Tags "Create" { Start-Sleep -Milliseconds 1000 # Avoids uniquesness error which only up to the second " Cannot insert duplicate key row in object 'dbo.CARD' with unique index 'CARD_NAME_I1'. The duplicate key value is (VUSERROLEADD-ISHUSERROLE20161012164716068A12/10/2016 16:47:16)." } It "Parameter IshObject invalid" { - { Add-IshUserRole -IShSession $ishSession -IshObject "INVALIDUSERROLE" } | Should -Throw + { Add-IshUserRole -IShSession $ishSession -IshObject "INVALIDUSERROLE" } | Should-Throw } It "Parameter IshObject Single with implicit IshSession" { $ishObjects = Add-IshUserRole -IshObject $ishObjectA $ishObjects | Remove-IshUserRole - $ishObjects.Count | Should -Be 1 + $ishObjects.Count | Should-Be 1 } It "Parameter IshObject Multiple with implicit IshSession" { $ishObjects = Add-IshUserRole -IshObject @($ishObjectB,$ishObjectC) $ishObjects | Remove-IshUserRole - $ishObjects.Count | Should -Be 2 + $ishObjects.Count | Should-Be 2 } It "Pipeline IshObject Single" { $ishObjects = $ishObjectD | Add-IshUserRole -IshSession $ishSession $ishObjects | Remove-IshUserRole -IshSession $ishSession - $ishObjects.Count | Should -Be 1 + $ishObjects.Count | Should-Be 1 } It "Pipeline IshObject Multiple" { $ishObjects = @($ishObjectE,$ishObjectF) | Add-IshUserRole -IshSession $ishSession $ishObjects | Remove-IshUserRole -IshSession $ishSession - $ishObjects.Count | Should -Be 2 + $ishObjects.Count | Should-Be 2 } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestAiInstructions.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestAiInstructions.Tests.ps1 index 4da893c..902f4c2 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestAiInstructions.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestAiInstructions.Tests.ps1 @@ -153,15 +153,15 @@ Describe 'AI instruction files are internally consistent and correctly wired' { Context 'Canonical file structure (.github/instructions/*.instructions.md)' { It 'instructions directory exists and contains files' { - Test-Path -LiteralPath $script:instrDir | Should -BeTrue + Test-Path -LiteralPath $script:instrDir | Should-BeTrue @(Get-ChildItem -LiteralPath $script:instrDir -Filter '*.instructions.md' -File).Count | - Should -BeGreaterThan 0 + Should-BeGreaterThan 0 } It "[] line 1 is '---' (YAML frontmatter, no code fence)" ` -TestCases $script:canonicalCases { (Get-Content -LiteralPath $CfPath -Encoding UTF8 -TotalCount 1) | - Should -BeExactly '---' -Because ( + Should-BeString -CaseSensitive '---' -Because ( "line 1 must open YAML frontmatter; a code fence makes applyTo: inert. " + "Remove any opening fence from '$CfName'.") } @@ -169,14 +169,14 @@ Describe 'AI instruction files are internally consistent and correctly wired' { It "[] frontmatter has non-empty 'applyTo:'" ` -TestCases $script:canonicalCases { Get-FmValue -FilePath $CfPath -Key 'applyTo' | - Should -Not -BeNullOrEmpty -Because ( + Should-NotBeNull -Because ( "'$CfName' needs applyTo: for AI coding agent auto-injection.") } It "[] frontmatter has non-empty 'description:'" ` -TestCases $script:canonicalCases { Get-FmValue -FilePath $CfPath -Key 'description' | - Should -Not -BeNullOrEmpty -Because ( + Should-NotBeNull -Because ( "'$CfName' needs description: for the agent to surface the file.") } } @@ -185,7 +185,7 @@ Describe 'AI instruction files are internally consistent and correctly wired' { Context 'AI coding agent stubs (.claude/rules/*.md)' { It 'rules directory exists' { - Test-Path -LiteralPath $script:rulesDir | Should -BeTrue -Because ( + Test-Path -LiteralPath $script:rulesDir | Should-BeTrue -Because ( ".claude/rules/ must exist for Claude Code-compatible path-scoped injection.") } @@ -193,7 +193,7 @@ Describe 'AI instruction files are internally consistent and correctly wired' { -TestCases $script:canonicalCases { $stem = Get-Stem $CfName Test-Path -LiteralPath (Join-Path $script:rulesDir ($stem + '.md')) | - Should -BeTrue -Because ( + Should-BeTrue -Because ( "'$CfName' requires a stub '$stem.md'. " + "Add .claude/rules/$stem.md with paths: matching applyTo:.") } @@ -202,7 +202,7 @@ Describe 'AI instruction files are internally consistent and correctly wired' { -TestCases $script:stubCases { $canonName = ($SfName -replace '\.md$', '') + '.instructions.md' Test-Path -LiteralPath (Join-Path $script:instrDir $canonName) | - Should -BeTrue -Because ( + Should-BeTrue -Because ( "stub '$SfName' has no matching canonical '$canonName'. " + "Add the canonical file or remove the orphaned stub.") } @@ -210,14 +210,14 @@ Describe 'AI instruction files are internally consistent and correctly wired' { It "[stub ] line 1 is '---' (YAML frontmatter)" ` -TestCases $script:stubCases { (Get-Content -LiteralPath $SfPath -Encoding UTF8 -TotalCount 1) | - Should -BeExactly '---' -Because ( + Should-BeString -CaseSensitive '---' -Because ( "stub '$SfName' must open with YAML frontmatter at line 1.") } It "[stub ] frontmatter has non-empty 'paths:'" ` -TestCases $script:stubCases { Get-FmValue -FilePath $SfPath -Key 'paths' | - Should -Not -BeNullOrEmpty -Because ( + Should-NotBeNull -Because ( "stub '$SfName' needs paths: for Claude Code-compatible path-scoped injection.") } } @@ -229,7 +229,7 @@ Describe 'AI instruction files are internally consistent and correctly wired' { -TestCases $script:pairedCases { $applyTo = @(Get-FmValue -FilePath $CfPath -Key 'applyTo' | Sort-Object) $paths = @(Get-FmValue -FilePath $SfPath -Key 'paths' | Sort-Object) - $applyTo | Should -BeExactly $paths -Because ( + $applyTo | Should-BeCollection $paths -Because ( "applyTo: in '$CfName' and paths: in '$SfName' must express the same glob. " + "Update the out-of-sync value - see AGENTS.md > Maintaining these instructions.") } @@ -239,12 +239,12 @@ Describe 'AI instruction files are internally consistent and correctly wired' { Context 'AGENTS.md lazy-load table coverage' { It 'AGENTS.md exists at repository root' { - Test-Path -LiteralPath $script:agentsMd | Should -BeTrue + Test-Path -LiteralPath $script:agentsMd | Should-BeTrue } It 'AGENTS.md contains the lazy-load directive block' { (Get-Content -LiteralPath $script:agentsMd -Encoding UTF8 -Raw) | - Should -Match 'Scoped instructions' -Because ( + Should-MatchString 'Scoped instructions' -Because ( "AGENTS.md must contain the Scoped instructions section for lazy loading.") } @@ -252,7 +252,7 @@ Describe 'AI instruction files are internally consistent and correctly wired' { -TestCases $script:canonicalCases { $expectedRef = '@.github/instructions/' + $CfName (Get-Content -LiteralPath $script:agentsMd -Encoding UTF8 -Raw) | - Should -Match ([regex]::Escape($expectedRef)) -Because ( + Should-MatchString ([regex]::Escape($expectedRef)) -Because ( "'$CfName' must have a row in the AGENTS.md at-ref table. " + "Add: | path description | $expectedRef |") } @@ -260,7 +260,7 @@ Describe 'AI instruction files are internally consistent and correctly wired' { It "[at-ref ] resolves to an existing canonical file" ` -TestCases $script:agentsRefCases { $p = Join-Path $RepoRoot ($Ref -replace '/', '\') - Test-Path -LiteralPath $p | Should -BeTrue -Because ( + Test-Path -LiteralPath $p | Should-BeTrue -Because ( "AGENTS.md references '@$Ref' but the file does not exist. " + "Add the canonical file or remove the stale at-ref.") } @@ -270,22 +270,22 @@ Describe 'AI instruction files are internally consistent and correctly wired' { Context 'Pointer files integrity' { It 'CLAUDE.md exists and contains @AGENTS.md import' { - Test-Path -LiteralPath $script:claudeMd | Should -BeTrue + Test-Path -LiteralPath $script:claudeMd | Should-BeTrue (Get-Content -LiteralPath $script:claudeMd -Encoding UTF8 -Raw) | - Should -Match '@AGENTS\.md' -Because ( + Should-MatchString '@AGENTS\.md' -Because ( "CLAUDE.md must import AGENTS.md for Claude Code-compatible harnesses.") } It '.github/copilot-instructions.md exists and references AGENTS.md' { - Test-Path -LiteralPath $script:copilotMd | Should -BeTrue + Test-Path -LiteralPath $script:copilotMd | Should-BeTrue (Get-Content -LiteralPath $script:copilotMd -Encoding UTF8 -Raw) | - Should -Match 'AGENTS\.md' -Because ( + Should-MatchString 'AGENTS\.md' -Because ( ".github/copilot-instructions.md must reference AGENTS.md (pointer, not duplicate).") } It '.github/copilot-instructions.md is a short pointer (under 25 lines)' { (Get-Content -LiteralPath $script:copilotMd -Encoding UTF8).Count | - Should -BeLessOrEqual 25 -Because ( + Should-BeLessThanOrEqual 25 -Because ( ".github/copilot-instructions.md must be a thin pointer. " + "Full content belongs in AGENTS.md. Keep under 25 lines.") } @@ -298,7 +298,7 @@ Describe 'AI instruction files are internally consistent and correctly wired' { -TestCases $script:canonicalCases { $violations = Get-HarnessViolation -Lines ( Get-Content -LiteralPath $CfPath -Encoding UTF8) - $violations | Should -BeNullOrEmpty -Because ( + $violations | Should-BeNull -Because ( "Use 'AI coding agent' instead of a product name. " + "Violations in '$CfName': $($violations -join '; ')") } @@ -306,7 +306,7 @@ Describe 'AI instruction files are internally consistent and correctly wired' { It 'AGENTS.md does not name a specific AI harness product' { $violations = Get-HarnessViolation -Lines ( Get-Content -LiteralPath $script:agentsMd -Encoding UTF8) - $violations | Should -BeNullOrEmpty -Because ( + $violations | Should-BeNull -Because ( "AGENTS.md must use 'AI coding agent'. Violations: $($violations -join '; ')") } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestAnonymization.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestAnonymization.Tests.ps1 index 7c1bb78..96bd459 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestAnonymization.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestAnonymization.Tests.ps1 @@ -83,7 +83,7 @@ Describe 'Public Doc and Samples stay anonymized' { } } } - , $leak.ToArray() + $leak.ToArray() } # Scans every text file under Doc/ and Samples/, returning ' L: '. @@ -114,22 +114,22 @@ Describe 'Public Doc and Samples stay anonymized' { } } } - , $finding.ToArray() + $finding.ToArray() } } It 'rules flag a non-anonymized sample (guard-for-the-guard)' { - Get-IshContentLeak -Line 'connect to https://realhost.acme.local/ISHWS/ now' | Should -Not -BeNullOrEmpty - Get-IshContentLeak -Line 'internal box at 10.20.30.40' | Should -Not -BeNullOrEmpty + Get-IshContentLeak -Line 'connect to https://realhost.acme.local/ISHWS/ now' | Should-NotBeNull + Get-IshContentLeak -Line 'internal box at 10.20.30.40' | Should-NotBeNull } It 'rules ignore the agreed example.com placeholders' { - Get-IshContentLeak -Line 'New-IshSession -WsBaseUrl https://ish.example.com/ISHWS/' | Should -BeNullOrEmpty - Get-IshContentLeak -Line 'Generate "https://hostname/InfoShareWS/" "username" "password"' | Should -BeNullOrEmpty + Get-IshContentLeak -Line 'New-IshSession -WsBaseUrl https://ish.example.com/ISHWS/' | Should-BeNull + Get-IshContentLeak -Line 'Generate "https://hostname/InfoShareWS/" "username" "password"' | Should-BeNull } It 'Doc and Samples contain no real URL, internal hostname, private IP or token' { $finding = Get-IshAnonymizationFinding - $finding | Should -BeNullOrEmpty -Because 'public material must use example.com placeholders (see .github/instructions/doc--markdown.instructions.md)' + $finding | Should-BeNull -Because 'public material must use example.com placeholders (see .github/instructions/doc--markdown.instructions.md)' } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestPrerequisite.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestPrerequisite.Tests.ps1 index 987cd11..3234131 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestPrerequisite.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/_TestEnvironment/TestPrerequisite.Tests.ps1 @@ -1,4 +1,5 @@ -BeforeAll { +#pester:no-parallel # Checks if the remote system is ready which will fail if other tests are already creating folders +BeforeAll { $cmdletName = "TestPrerequisite.Tests.ps1" Write-Host ("`r`nLoading ISHRemote.PesterSetup.ps1 on PSVersion[" + $psversionTable.PSVersion + "] over BeforeAll-block for MyCommand[" + $cmdletName + "]...") . (Join-Path (Split-Path -Parent $PSCommandPath) "\..\..\ISHRemote.PesterSetup.ps1") @@ -9,67 +10,67 @@ Describe "Test-Prerequisite" -Tags "Read" { Context "Package ISHRemote verification" { It "Folder ISHRemote exists" { - Test-Path -Path $moduleFolder | Should -Be $true - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "ISHRemote.psm1") | Should -Be $true - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "ISHRemote.psd1") | Should -Be $true - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "ISHRemote.Format.ps1xml") | Should -Be $true - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "Trisoft.ISHRemote.dll-Help.xml") | Should -Be $true + Test-Path -Path $moduleFolder | Should-Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "ISHRemote.psm1") | Should-Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "ISHRemote.psd1") | Should-Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "ISHRemote.Format.ps1xml") | Should-Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "Trisoft.ISHRemote.dll-Help.xml") | Should-Be $true } It "Folder ISHRemote/Scripts exists" { - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "Scripts") | Should -Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "Scripts") | Should-Be $true } It "Folder ISHRemote/Scripts/Public exists" { - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "Scripts/Public") | Should -Be $true - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "Scripts/Public/Expand-ISHParameter.ps1") | Should -Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "Scripts/Public") | Should-Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "Scripts/Public/Expand-ISHParameter.ps1") | Should-Be $true } It "Folder ISHRemote/Scripts/Private exists" { - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "Scripts/Private") | Should -Be $true - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "Scripts/Private/Register-IshAuxParameterCompleter.ps1") | Should -Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "Scripts/Private") | Should-Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "Scripts/Private/Register-IshAuxParameterCompleter.ps1") | Should-Be $true } It "Folder ISHRemote/net48 exists" { - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net48") | Should -Be $true - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net48/Trisoft.ISHRemote.dll") | Should -Be $true - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net48/Trisoft.ISHRemote.xml") | Should -Be $true - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net48/Trisoft.ISHRemote.dll-Help.xml") | Should -Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net48") | Should-Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net48/Trisoft.ISHRemote.dll") | Should-Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net48/Trisoft.ISHRemote.xml") | Should-Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net48/Trisoft.ISHRemote.dll-Help.xml") | Should-Be $true } It "Folder ISHRemote/net6.0 exists" { - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net6.0") | Should -Be $true - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net6.0/Trisoft.ISHRemote.dll") | Should -Be $true - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net6.0/Trisoft.ISHRemote.xml") | Should -Be $true - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net6.0/Trisoft.ISHRemote.dll-Help.xml") | Should -Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net6.0") | Should-Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net6.0/Trisoft.ISHRemote.dll") | Should-Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net6.0/Trisoft.ISHRemote.xml") | Should-Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net6.0/Trisoft.ISHRemote.dll-Help.xml") | Should-Be $true } It "Folder ISHRemote/net10.0 exists" { - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net10.0") | Should -Be $true - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net10.0/Trisoft.ISHRemote.dll") | Should -Be $true - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net10.0/Trisoft.ISHRemote.xml") | Should -Be $true - Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net10.0/Trisoft.ISHRemote.dll-Help.xml") | Should -Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net10.0") | Should-Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net10.0/Trisoft.ISHRemote.dll") | Should-Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net10.0/Trisoft.ISHRemote.xml") | Should-Be $true + Test-Path -Path (Join-Path -Path $moduleFolder -ChildPath "net10.0/Trisoft.ISHRemote.dll-Help.xml") | Should-Be $true } } Context "ISHRemote.PesterSetup.Debug.ps1 minimal overwrites" { It "baseUrl" { - $baseUrl | Should -Not -Be 'https://ish.example.com' - $baseUrl | Should -Not -Be '' + $baseUrl | Should-NotBe 'https://ish.example.com' + $baseUrl | Should-NotBe '' } It "webServicesBaseUrl" { - $webServicesBaseUrl | Should -Not -Be '$baseUrl/ISHWS/' - $webServicesBaseUrl | Should -Not -Be '' + $webServicesBaseUrl | Should-NotBe '$baseUrl/ISHWS/' + $webServicesBaseUrl | Should-NotBe '' } It "ishUserName" { - $ishUserName | Should -Not -Be 'myusername' - $ishUserName | Should -Not -Be '' + $ishUserName | Should-NotBe 'myusername' + $ishUserName | Should-NotBe '' } It "ishPassword" { - $ishPassword | Should -Not -Be 'mypassword' - $ishPassword | Should -Not -Be '' + $ishPassword | Should-NotBe 'mypassword' + $ishPassword | Should-NotBe '' } It "amClientId" { - $amClientId | Should -Not -Be 'myserviceaccountclientid' - $amClientId | Should -Not -Be '' + $amClientId | Should-NotBe 'myserviceaccountclientid' + $amClientId | Should-NotBe '' } It "amClientSecret" { - $amClientSecret | Should -Not -Be 'myserviceaccountclientsecret' - $amClientSecret | Should -Not -Be '' + $amClientSecret | Should-NotBe 'myserviceaccountclientsecret' + $amClientSecret | Should-NotBe '' } } @@ -80,52 +81,52 @@ Describe "Test-Prerequisite" -Tags "Read" { } It "IshSession.Protocol WcfSoapWithOpenIdConnect" { if (([Version]$ishSession.ServerVersion).Major -eq 15) { - $IshSession.Protocol | Should -Be 'WcfSoapWithOpenIdConnect' + $IshSession.Protocol | Should-Be 'WcfSoapWithOpenIdConnect' } } It "Current IShSession user over ClientId/ClientSecret should match UserName parameter so all tests run under the same account" { if (([Version]$ishSession.ServerVersion).Major -eq 15) { - $ishUser.UserName | Should -Be $ishUserName + $ishUser.UserName | Should-Be $ishUserName } } It "Current IShSession user should be part of VUSERGROUPSYSTEMMANAGEMENT UserGroup" { if (([Version]$ishSession.ServerVersion).Major -eq 15) { - $ishUser.fusergroup_none_element -like "*VUSERGROUPSYSTEMMANAGEMENT*" | Should -Be $true + $ishUser.fusergroup_none_element -like "*VUSERGROUPSYSTEMMANAGEMENT*" | Should-Be $true } } It "Current IShSession user identified over CliendId/ClientSecret should match the IshUserName/IshPassword" { if (([Version]$ishSession.ServerVersion).Major -eq 15) { - $ishUser.username | Should -Be $ishUserName + $ishUser.username | Should-Be $ishUserName } } It "IshSession.AuthenticationContext" { - $ishSession.AuthenticationContext | Should -Not -BeNullOrEmpty + $ishSession.AuthenticationContext | Should-NotBeNull } It "IshSession.ClientVersion" { - $ishSession.ClientVersion | Should -Not -BeNullOrEmpty + $ishSession.ClientVersion | Should-NotBeNull } It "IshSession.ClientVersion not 0.0.0.0" { - $ishSession.ClientVersion | Should -Not -Be "0.0.0.0" + $ishSession.ClientVersion | Should-NotBe "0.0.0.0" } It "IshSession.ServerVersion empty (ISHWS down?)" { - $ishSession.ServerVersion | Should -Not -BeNullOrEmpty + $ishSession.ServerVersion | Should-NotBeNull } It "IshSession.ServerVersion not 0.0.0.0" { - $ishSession.ServerVersion | Should -Not -Be "0.0.0.0" + $ishSession.ServerVersion | Should-NotBe "0.0.0.0" } } Context "IshFolder - Manual clean up required, probably a lock blocked the previous test clean-up" { It "ISHRemote root folder exists" { $ishFolder = Get-IshFolder -IshSession $ishSession -FolderPath $folderTestRootPath - $ishFolder.IshFolderRef -ge 0 | Should -Be $true + $ishFolder.IshFolderRef -ge 0 | Should-Be $true } It "ISHRemote root folder should be empty, probably clean up failed test folders and data" { $commands = (Get-Command -Module ISHRemote).Name $subIshFolders = Get-IshFolder -IshSession $ishSession -FolderPath $folderTestRootPath -Recurse -Depth 2 foreach($subIshFolderName in $subIshFolders.name) { - if ($commands -contains $subIshFolderName) { $subIshFolderName | Should -Be "" } + if ($commands -contains $subIshFolderName) { $subIshFolderName | Should-Be "" } } } } @@ -133,29 +134,29 @@ Describe "Test-Prerequisite" -Tags "Read" { Context "ListOfValues - Potential overwrite in ISHRemote.PesterSetup.Debug.ps1" { It "Parameter DLANGUAGE labels exist" { $ishLovValues = Get-IshLovValue -IshSession $ishSession -LovId DLANGUAGE - $ishLovValues.Label -contains $ishLngLabel | Should -Be $true - $ishLovValues.Label -contains $ishLngTarget1Label | Should -Be $true - $ishLovValues.Label -contains $ishLngTarget2Label | Should -Be $true - $ishLovValues.Label -contains $ishLngCombination | Should -Be $true + $ishLovValues.Label -contains $ishLngLabel | Should-Be $true + $ishLovValues.Label -contains $ishLngTarget1Label | Should-Be $true + $ishLovValues.Label -contains $ishLngTarget2Label | Should-Be $true + $ishLovValues.Label -contains $ishLngCombination | Should-Be $true } It "Parameter DLANGUAGE ishLngTarget1 exists" { $ishLovValue = Get-IshLovValue -IshSession $ishSession -LovId DLANGUAGE -LovValueId $ishLngTarget1 - $ishLovValue.IshRef | Should -Be $ishLngTarget1 + $ishLovValue.IshRef | Should-Be $ishLngTarget1 } It "Parameter DLANGUAGE ishLngTarget2 exists" { $ishLovValue = Get-IshLovValue -IshSession $ishSession -LovId DLANGUAGE -LovValueId $ishLngTarget2 - $ishLovValue.IshRef | Should -Be $ishLngTarget2 + $ishLovValue.IshRef | Should-Be $ishLngTarget2 } } Context "Statuses - Potential overwrite in ISHRemote.PesterSetup.Debug.ps1" { It "Parameter DSTATUS ishStatusDraft exist" { $ishLovValue = Get-IshLovValue -IshSession $ishSession -LovId DSTATUS -LovValueId $ishStatusDraft - $ishLovValue.IshRef | Should -Be $ishStatusDraft + $ishLovValue.IshRef | Should-Be $ishStatusDraft } It "Parameter DSTATUS ishStatusReleased exist" { $ishLovValue = Get-IshLovValue -IshSession $ishSession -LovId DSTATUS -LovValueId $ishStatusReleased - $ishLovValue.IshRef | Should -Be $ishStatusReleased + $ishLovValue.IshRef | Should-Be $ishStatusReleased } It "Status Transition from ishStatusDraft to exists ishStatusReleased" { # Direct status transition from $ishStatusDraft (D) to $ishStatusReleased (R) is required by the executing user @@ -163,10 +164,10 @@ Describe "Test-Prerequisite" -Tags "Read" { $fromStatusDraft = $stateConfiguration.InfoShareStates.Transitions.FromStatus | Where-Object ref -eq $ishStatusDraft $toStatusReleased = $fromStatusDraft.ToStatus | Where-Object ref -eq $ishStatusReleased if ($toStatusReleased -is [array]) { - $toStatusReleased.Ref -contains $ishStatusReleased | Should -Be $true + $toStatusReleased.Ref -contains $ishStatusReleased | Should-Be $true } else { - $toStatusReleased.ref | Should -Be $ishStatusReleased + $toStatusReleased.ref | Should-Be $ishStatusReleased } } } @@ -184,11 +185,11 @@ Describe "Test-Prerequisite" -Tags "Read" { } } It "Current User has UserRole Administrator access" { - $ishUser.fishuserroles_none_element -like '*VUSERROLEADMINISTRATOR*' | Should -Be $true + $ishUser.fishuserroles_none_element -like '*VUSERROLEADMINISTRATOR*' | Should-Be $true } It "Current User has UserGroup System Management access" { # Otherwise error [-102009] Unable to complete your request, you are not allowed to alter folder "System". - $ishUser.fusergroup_none_element -like '*VUSERGROUPSYSTEMMANAGEMENT*' | Should -Be $true + $ishUser.fusergroup_none_element -like '*VUSERGROUPSYSTEMMANAGEMENT*' | Should-Be $true } It "Current User has user role to do Status Transition from ishStatusDraft to ishStatusReleased" { # Direct status transition from $ishStatusDraft (D) to $ishStatusReleased (R) is required by the executing user @@ -198,19 +199,19 @@ Describe "Test-Prerequisite" -Tags "Read" { $fromStatusDraftToReleased = $fromStatusDraft | Where-Object {$_.ToStatus.ref -eq $ishStatusReleased} $userRolesRequiredForStatusTransition = $fromStatusDraftToReleased.userrole foreach ($userRole in $userRolesRequiredForStatusTransition) { - $ishUser.fishuserroles -like "*$($userRole)*" | Should -Be $true + $ishUser.fishuserroles -like "*$($userRole)*" | Should-Be $true } } It "Parameter Author ishUserAuthor exist" { $ishUser = Get-IshUser -IshSession $ishSession -Id $ishUserAuthor - $ishUser.IshRef | Should -Be $ishUserAuthor + $ishUser.IshRef | Should-Be $ishUserAuthor } } Context "OutputFormat - Potential overwrite in ISHRemote.PesterSetup.Debug.ps1" { It "Parameter DITA XML ishOutputFormatDitaXml exist" { $ishOUtputFormat = Get-IshOutputFormat -IshSession $ishSession -Id $ishOutputFormatDitaXml - $ishOUtputFormat.IshRef | Should -Be $ishOutputFormatDitaXml + $ishOUtputFormat.IshRef | Should-Be $ishOutputFormatDitaXml } } @@ -220,7 +221,7 @@ Describe "Test-Prerequisite" -Tags "Read" { # $ishEventTypeToPurge = "PUSHTRANSLATIONS" [xml]$backgroundTaskConfiguration = Get-IshSetting -FieldName FISHBACKGROUNDTASKCONFIG $handler = $backgroundTaskConfiguration.infoShareBackgroundTaskConfig.handlers.handler | Where-Object eventType -eq $ishEventTypeToPurge - $handler.eventType | Should -Be $ishEventTypeToPurge + $handler.eventType | Should-Be $ishEventTypeToPurge } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/HelperClasses/CertificateValidationHelper.cs b/Source/ISHRemote/Trisoft.ISHRemote/HelperClasses/CertificateValidationHelper.cs index e8fdf3b..b3babfc 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/HelperClasses/CertificateValidationHelper.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/HelperClasses/CertificateValidationHelper.cs @@ -23,7 +23,6 @@ using System.Net; using System.Text.RegularExpressions; using Trisoft.ISHRemote.Interfaces; -using Trisoft.ISHRemote.Cmdlets; namespace Trisoft.ISHRemote.HelperClasses { @@ -36,7 +35,6 @@ public static class CertificateValidationHelper #if NET48 private static RemoteCertificateValidationCallback _originalCallback; #endif - private static readonly ILogger _logger = TrisoftCmdletLogger.Instance(); private static bool OnValidateCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { @@ -69,9 +67,9 @@ private static bool OnValidateCertificate(object sender, X509Certificate certifi /// /// Sets our custom AppDomain ssl/certificate overwrite callback using ServicePointManager, including a backup of any existing callback /// - public static void OverrideCertificateValidation() + public static void OverrideCertificateValidation(ILogger logger) { - _logger.WriteWarning("Applying certificate validation overwrite for the AppDomain. (OnValidateCertificate)"); + logger.WriteWarning("Applying certificate validation overwrite for the AppDomain. (OnValidateCertificate)"); _originalCallback = ServicePointManager.ServerCertificateValidationCallback; ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(OnValidateCertificate); ServicePointManager.Expect100Continue = true; @@ -80,9 +78,9 @@ public static void OverrideCertificateValidation() /// /// Removes our custom AppDomain ssl/certificate overwrite callback using ServicePointManager by restoring our ealier backup of any existing callback /// - public static void RestoreCertificateValidation() + public static void RestoreCertificateValidation(ILogger logger) { - _logger.WriteDebug("Restoring backup of the earlier saved certificate validation for the AppDomain. (OnValidateCertificate)"); + logger.WriteDebug("Restoring backup of the earlier saved certificate validation for the AppDomain. (OnValidateCertificate)"); ServicePointManager.ServerCertificateValidationCallback = _originalCallback; } #endif diff --git a/Source/ISHRemote/Trisoft.ISHRemote/ISHRemote.PesterSetup.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/ISHRemote.PesterSetup.ps1 index fa75c50..803b26e 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/ISHRemote.PesterSetup.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/ISHRemote.PesterSetup.ps1 @@ -2,9 +2,9 @@ # Tests Header dot-sourced import PS1 file for *.Tests.ps1 files # -# Quick check if you are using Pester 5, or default installed Pester 3.4.0 (#132) +# Quick check if you are using Pester 6, or default installed Pester 3.4.0 (#132, #242) $pesterVersion = [version](Get-Command Invoke-Pester).Version -if ($pesterVersion -lt [version]("5.3.0")) { Write-Warning ("ISHRemote.PesterSetup.ps1 Invoke-Pester version["+$pesterVersion+"] while 5.3+ is expected!") } +if ($pesterVersion -lt [version]("6.0.0")) { Write-Warning ("ISHRemote.PesterSetup.ps1 Invoke-Pester version["+$pesterVersion+"] while 6.0+ is expected!") } $DebugPreference = "SilentlyContinue" # Continue or SilentlyContinue $VerbosePreference = "SilentlyContinue" # Continue or SilentlyContinue @@ -128,17 +128,30 @@ $isLinuxContainerized = $baseUrl.Contains('.sdldev.net') #{ $webServicesConnectionConfigurationUrl = $webServicesBaseUrl + "connectionconfiguration.xml" Write-Host "Running ISHRemote.PesterSetup.ps1 Detect version over webServicesConnectionConfigurationUrl[$webServicesConnectionConfigurationUrl] webServicesConnectionConfigurationUrl.Length[$($webServicesConnectionConfigurationUrl.Length)]" - # $connectionConfigurationRaw = Invoke-RestMethod -Uri $webServicesConnectionConfigurationUrl #Only PS7#-SkipCertificateCheck - $connectionConfigurationRaw = (Invoke-WebRequest -Uri $webServicesConnectionConfigurationUrl -UseBasicParsing).Content #as Kestrel/IIS behave differently - $connectionConfigurationRaw -match "(?.*)" # Straight string handling avoids UTF8-BOM cross-platform handling - [version]$infosharesoftwareversion = $matches['myVersion'] - if ($infosharesoftwareversion.Major -lt 15) # 14SP4 and earlier, initialize ONE session over -IshUserName/-IshPassword - { - $global:ishSession = New-IshSession -Protocol WcfSoapWithWsTrust -WsBaseUrl $webServicesBaseUrl -IshUserName $ishUserName -IshPassword $ishPassword -WarningAction SilentlyContinue + try { + # $connectionConfigurationRaw = Invoke-RestMethod -Uri $webServicesConnectionConfigurationUrl #Only PS7#-SkipCertificateCheck + $connectionConfigurationRaw = (Invoke-WebRequest -Uri $webServicesConnectionConfigurationUrl -UseBasicParsing).Content #as Kestrel/IIS behave differently + if (-not ($connectionConfigurationRaw -match "(?.*)")) # Straight string handling avoids UTF8-BOM cross-platform handling + { + throw "ISHRemote.PesterSetup.ps1: Could not find in response from $webServicesConnectionConfigurationUrl. Response length[$($connectionConfigurationRaw.Length)]" + } + [version]$infosharesoftwareversion = $matches['myVersion'] + if ($infosharesoftwareversion.Major -lt 15) # 14SP4 and earlier, initialize ONE session over -IshUserName/-IshPassword + { + $global:ishSession = New-IshSession -Protocol WcfSoapWithWsTrust -WsBaseUrl $webServicesBaseUrl -IshUserName $ishUserName -IshPassword $ishPassword -WarningAction SilentlyContinue + } + else # 15 and later, initialize ONE session over -ClientId/-ClientSecret + { + $global:ishSession = New-IshSession -Protocol WcfSoapWithOpenIdConnect -WsBaseUrl $webServicesBaseUrl -ClientId $amClientId -ClientSecret $amClientSecret -WarningAction SilentlyContinue + } + if ($null -eq $global:ishSession) + { + throw "ISHRemote.PesterSetup.ps1: New-IshSession returned null for webServicesBaseUrl[$webServicesBaseUrl]" + } } - else # 15 and later, initialize ONE session over -ClientId/-ClientSecret - { - $global:ishSession = New-IshSession -Protocol WcfSoapWithOpenIdConnect -WsBaseUrl $webServicesBaseUrl -ClientId $amClientId -ClientSecret $amClientSecret -WarningAction SilentlyContinue + catch { + Write-Error "ISHRemote.PesterSetup.ps1: Session initialization failed on PSVersion[$($PSVersionTable.PSVersion)] webServicesBaseUrl[$webServicesBaseUrl]: $_" + throw } #} $ishSession = $global:ishSession diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Objects/Public/IshSession.cs b/Source/ISHRemote/Trisoft.ISHRemote/Objects/Public/IshSession.cs index 42c9fbb..c93f5df 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Objects/Public/IshSession.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Objects/Public/IshSession.cs @@ -51,6 +51,7 @@ public class IshSession : IDisposable private IshVersion _serverVersion; private IshVersion _clientVersion; private IshTypeFieldSetup _ishTypeFieldSetup; + private readonly object _ishTypeFieldSetupLock = new object(); private Enumerations.StrictMetadataPreference _strictMetadataPreference = Enumerations.StrictMetadataPreference.Continue; private NameHelper _nameHelper; private Enumerations.PipelineObjectPreference _pipelineObjectPreference = Enumerations.PipelineObjectPreference.PSObjectNoteProperty; @@ -124,7 +125,7 @@ public IshSession(ILogger logger, string webServicesBaseUrl, string ishUserName, _logger.WriteDebug($"Enabling Tls, Tls11, Tls12 and Tls13 security protocols on AppDomain. Timeout[{_timeout}] IgnoreSslPolicyErrors[{_ignoreSslPolicyErrors}]"); if (_ignoreSslPolicyErrors) { - CertificateValidationHelper.OverrideCertificateValidation(); + CertificateValidationHelper.OverrideCertificateValidation(_logger); } ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13; #endif @@ -288,44 +289,49 @@ internal IshTypeFieldSetup IshTypeFieldSetup { if (_ishTypeFieldSetup == null) { - if (_serverVersion.MajorVersion >= 13) + lock (_ishTypeFieldSetupLock) { - switch (Protocol) + if (_ishTypeFieldSetup == null) { - case Enumerations.Protocol.OpenApiWithOpenIdConnect: - // TODO [Must] Add OpenApi implementation - case Enumerations.Protocol.WcfSoapWithWsTrust: - case Enumerations.Protocol.WcfSoapWithOpenIdConnect: - _logger.WriteDebug($"Loading Settings25.RetrieveFieldSetupByIshType..."); - _ishTypeFieldSetup = new IshTypeFieldSetup(_logger, Settings25.RetrieveFieldSetupByIshType(null), ServerIshVersion); - break; + if (_serverVersion.MajorVersion >= 13) + { + switch (Protocol) + { + case Enumerations.Protocol.OpenApiWithOpenIdConnect: + // TODO [Must] Add OpenApi implementation + case Enumerations.Protocol.WcfSoapWithWsTrust: + case Enumerations.Protocol.WcfSoapWithOpenIdConnect: + _logger.WriteDebug($"Loading Settings25.RetrieveFieldSetupByIshType..."); + _ishTypeFieldSetup = new IshTypeFieldSetup(_logger, Settings25.RetrieveFieldSetupByIshType(null), ServerIshVersion); + break; + } + _ishTypeFieldSetup.StrictMetadataPreference = _strictMetadataPreference; + } + else + { + _logger.WriteDebug($"Loading TriDKXmlSetupFullExport_12_00_01..."); + var triDKXmlSetupHelper = new TriDKXmlSetupHelper(_logger, Properties.Resouces.ISHTypeFieldSetup.TriDKXmlSetupFullExport_12_00_01); + _ishTypeFieldSetup = new IshTypeFieldSetup(_logger, triDKXmlSetupHelper.IshTypeFieldDefinition) + { + StrictMetadataPreference = Enumerations.StrictMetadataPreference.Off // Otherwise custom metadata fields are always removed as they are unknown for the default TriDKXmlSetup Resource + }; + } + + if (_serverVersion.MajorVersion == 13 || (_serverVersion.MajorVersion == 14 && _serverVersion.RevisionVersion < 4)) + { + // Loading/Merging Settings ISHMetadataBinding for 13/13.0.0 up till 14SP4/14.0.4 setup + // Note that IMetadataBinding was introduced in 2016/12.0.0 but there was no dynamic FieldSetup retrieval + // Passing IshExtensionConfig object to IshTypeFieldSetup constructor + _logger.WriteDebug($"Loading Settings25.GetMetadata for field[" + FieldElements.ExtensionConfiguration + "]..."); + IshFields metadata = new IshFields(); + metadata.AddField(new IshRequestedMetadataField(FieldElements.ExtensionConfiguration, Enumerations.Level.None, Enumerations.ValueType.Value)); // do not pass over IshTypeFieldSetup.ToIshRequestedMetadataFields, as we are initializing that object + string xmlIshObjects = Settings25.GetMetadata(metadata.ToXml()); + var ishFields = new IshObjects(xmlIshObjects).Objects[0].IshFields; + string xmlSettingsExtensionConfig = ishFields.GetFieldValue(FieldElements.ExtensionConfiguration, Enumerations.Level.None, Enumerations.ValueType.Value); + IshSettingsExtensionConfig.MergeIntoIshTypeFieldSetup(_logger, _ishTypeFieldSetup, xmlSettingsExtensionConfig); + } } - _ishTypeFieldSetup.StrictMetadataPreference = _strictMetadataPreference; } - else - { - _logger.WriteDebug($"Loading TriDKXmlSetupFullExport_12_00_01..."); - var triDKXmlSetupHelper = new TriDKXmlSetupHelper(_logger, Properties.Resouces.ISHTypeFieldSetup.TriDKXmlSetupFullExport_12_00_01); - _ishTypeFieldSetup = new IshTypeFieldSetup(_logger, triDKXmlSetupHelper.IshTypeFieldDefinition) - { - StrictMetadataPreference = Enumerations.StrictMetadataPreference.Off // Otherwise custom metadata fields are always removed as they are unknown for the default TriDKXmlSetup Resource - }; - } - - if (_serverVersion.MajorVersion == 13 || (_serverVersion.MajorVersion == 14 && _serverVersion.RevisionVersion < 4)) - { - // Loading/Merging Settings ISHMetadataBinding for 13/13.0.0 up till 14SP4/14.0.4 setup - // Note that IMetadataBinding was introduced in 2016/12.0.0 but there was no dynamic FieldSetup retrieval - // Passing IshExtensionConfig object to IshTypeFieldSetup constructor - _logger.WriteDebug($"Loading Settings25.GetMetadata for field[" + FieldElements.ExtensionConfiguration + "]..."); - IshFields metadata = new IshFields(); - metadata.AddField(new IshRequestedMetadataField(FieldElements.ExtensionConfiguration, Enumerations.Level.None, Enumerations.ValueType.Value)); // do not pass over IshTypeFieldSetup.ToIshRequestedMetadataFields, as we are initializing that object - string xmlIshObjects = Settings25.GetMetadata(metadata.ToXml()); - var ishFields = new IshObjects(xmlIshObjects).Objects[0].IshFields; - string xmlSettingsExtensionConfig = ishFields.GetFieldValue(FieldElements.ExtensionConfiguration, Enumerations.Level.None, Enumerations.ValueType.Value); - IshSettingsExtensionConfig.MergeIntoIshTypeFieldSetup(_logger, _ishTypeFieldSetup, xmlSettingsExtensionConfig); - } - } return _ishTypeFieldSetup; } @@ -477,7 +483,10 @@ public List IshTypeFieldDefinition } internal set { - _ishTypeFieldSetup = new IshTypeFieldSetup(_logger, value); + lock (_ishTypeFieldSetupLock) + { + _ishTypeFieldSetup = new IshTypeFieldSetup(_logger, value); + } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/Invoke-IshRemoteMcpHandleRequest.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/Invoke-IshRemoteMcpHandleRequest.Tests.ps1 index f9585e8..d2853e9 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/Invoke-IshRemoteMcpHandleRequest.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/Invoke-IshRemoteMcpHandleRequest.Tests.ps1 @@ -31,28 +31,28 @@ Describe "Invoke-IshRemoteMcpHandleRequest" -Skip:($PSVersionTable.PSVersion.Maj } It "Should return jsonrpc 2.0" { $json = $result | ConvertFrom-Json - $json.jsonrpc | Should -Be "2.0" + $json.jsonrpc | Should-Be "2.0" } It "Should return matching request id" { $json = $result | ConvertFrom-Json - $json.id | Should -Be 1 + $json.id | Should-Be 1 } It "Should contain protocolVersion" { $json = $result | ConvertFrom-Json - $json.result.protocolVersion | Should -Be "2024-11-05" + $json.result.protocolVersion | Should-Be "2024-11-05" } It "Should contain capabilities" { $json = $result | ConvertFrom-Json - $json.result.capabilities | Should -Not -BeNullOrEmpty + $json.result.capabilities | Should-NotBeNull } It "Should contain instructions" { $json = $result | ConvertFrom-Json - $json.result.instructions | Should -Be "test instructions" + $json.result.instructions | Should-Be "test instructions" } It "Should contain serverInfo" { $json = $result | ConvertFrom-Json - $json.result.serverInfo.name | Should -Not -BeNullOrEmpty - $json.result.serverInfo.version | Should -Not -BeNullOrEmpty + $json.result.serverInfo.name | Should-NotBeNull + $json.result.serverInfo.version | Should-NotBeNull } } @@ -71,15 +71,15 @@ Describe "Invoke-IshRemoteMcpHandleRequest" -Skip:($PSVersionTable.PSVersion.Maj } It "Should return jsonrpc 2.0" { $json = $result | ConvertFrom-Json - $json.jsonrpc | Should -Be "2.0" + $json.jsonrpc | Should-Be "2.0" } It "Should return matching request id" { $json = $result | ConvertFrom-Json - $json.id | Should -Be 2 + $json.id | Should-Be 2 } It "Should return empty result" { $json = $result | ConvertFrom-Json - $json.result | Should -BeNullOrEmpty + ($json.result | ConvertTo-Json -Compress) | Should-BeString '{}' } } @@ -99,15 +99,15 @@ Describe "Invoke-IshRemoteMcpHandleRequest" -Skip:($PSVersionTable.PSVersion.Maj } It "Should return jsonrpc 2.0" { $json = $result | ConvertFrom-Json - $json.jsonrpc | Should -Be "2.0" + $json.jsonrpc | Should-Be "2.0" } It "Should return matching request id" { $json = $result | ConvertFrom-Json - $json.id | Should -Be 3 + $json.id | Should-Be 3 } It "Should contain tools list" { $json = $result | ConvertFrom-Json - $json.result.tools | Should -Not -BeNullOrEmpty + $json.result.tools | Should-NotBeNull } } @@ -131,23 +131,23 @@ Describe "Invoke-IshRemoteMcpHandleRequest" -Skip:($PSVersionTable.PSVersion.Maj } It "Should return jsonrpc 2.0" { $json = $result | ConvertFrom-Json - $json.jsonrpc | Should -Be "2.0" + $json.jsonrpc | Should-Be "2.0" } It "Should return matching request id" { $json = $result | ConvertFrom-Json - $json.id | Should -Be 4 + $json.id | Should-Be 4 } It "Should contain result content" { $json = $result | ConvertFrom-Json - $json.result.content | Should -Not -BeNullOrEmpty + $json.result.content | Should-NotBeNull } It "Should have content type text" { $json = $result | ConvertFrom-Json - $json.result.content[0].type | Should -Be "text" + $json.result.content[0].type | Should-Be "text" } It "Should have isError false" { $json = $result | ConvertFrom-Json - $json.result.isError | Should -Be $false + $json.result.isError | Should-Be $false } } @@ -184,19 +184,19 @@ Describe "Invoke-IshRemoteMcpHandleRequest" -Skip:($PSVersionTable.PSVersion.Maj } It "Should return error response" { $json = $result | ConvertFrom-Json - $json.error | Should -Not -BeNullOrEmpty + $json.error | Should-NotBeNull } It "Should return error code -32601" { $json = $result | ConvertFrom-Json - $json.error.code | Should -Be -32601 + $json.error.code | Should-Be -32601 } It "Should return 'Method not found' message" { $json = $result | ConvertFrom-Json - $json.error.message | Should -Be "Method not found" + $json.error.message | Should-Be "Method not found" } } } AfterAll { Write-Host ("Running "+$cmdletName+" Test Data and Variables cleanup") -} \ No newline at end of file +} diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/Register-IshRemoteMcpInstructions.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/Register-IshRemoteMcpInstructions.Tests.ps1 index 8be1140..4ab064f 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/Register-IshRemoteMcpInstructions.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/Register-IshRemoteMcpInstructions.Tests.ps1 @@ -14,7 +14,7 @@ Describe "Register-IshRemoteMcpInstructions" -Skip:($PSVersionTable.PSVersion.Ma It "Should return non-empty string" { $result = Register-IshRemoteMcpInstructions - $result | Should -Not -BeNullOrEmpty + $result | Should-NotBeNull } } @@ -24,51 +24,51 @@ Describe "Register-IshRemoteMcpInstructions" -Skip:($PSVersionTable.PSVersion.Ma } It "Should contain New-IshSession cmdlet reference" { - $instructions | Should -Match "New-IShSession" + $instructions | Should-MatchString "New-IShSession" } It "Should contain Get-IshTypeFieldDefinition reference" { - $instructions | Should -Match "Get-IshTypeFieldDefinition" + $instructions | Should-MatchString "Get-IshTypeFieldDefinition" } It "Should contain FilterOperator reference" { - $instructions | Should -Match "FilterOperator" + $instructions | Should-MatchString "FilterOperator" } It "Should contain field types (String, Number, DateTime, LongText)" { - $instructions | Should -Match "String" - $instructions | Should -Match "Number" - $instructions | Should -Match "DateTime" - $instructions | Should -Match "LongText" + $instructions | Should-MatchString "String" + $instructions | Should-MatchString "Number" + $instructions | Should-MatchString "DateTime" + $instructions | Should-MatchString "LongText" } It "Should contain ISHType object references" { - $instructions | Should -Match "IShUser" - $instructions | Should -Match "IShFolder" - $instructions | Should -Match "IShDocumentObj" + $instructions | Should-MatchString "IShUser" + $instructions | Should-MatchString "IShFolder" + $instructions | Should-MatchString "IShDocumentObj" } It "Should contain level references (logical, version, lng)" { - $instructions | Should -Match "logical" - $instructions | Should -Match "version" - $instructions | Should -Match "lng" + $instructions | Should-MatchString "logical" + $instructions | Should-MatchString "version" + $instructions | Should-MatchString "lng" } It "Should mention PSNoteType properties" { - $instructions | Should -Match "PSNoteType" + $instructions | Should-MatchString "PSNoteType" } It "Should contain Get-Help cmdlet reference" { - $instructions | Should -Match "Get-Help" + $instructions | Should-MatchString "Get-Help" } It "Should mention case-sensitivity" { - $instructions | Should -Match "case-sensitive" + $instructions | Should-MatchString "case-sensitive" } It "Should contain wildcard operator guidance" { - $instructions | Should -Match "percentage" - $instructions | Should -Match "%" + $instructions | Should-MatchString "percentage" + $instructions | Should-MatchString "%" } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/Register-IshRemoteMcpTool.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/Register-IshRemoteMcpTool.Tests.ps1 index a2bb8d4..d2aa65a 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/Register-IshRemoteMcpTool.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/Register-IshRemoteMcpTool.Tests.ps1 @@ -24,18 +24,18 @@ Describe "Register-IshRemoteMcpTool" -Tags "Read" -Skip:($PSVersionTable.PSVersi {"name":"Get-IshFolder","description":"The Get-IshFolder cmdlet retrieves metadata for the folders by providing one of the following input data: - FolderPath string with the separated full folder path - FolderIds array containing identifiers of the folders - BaseFolder enum value referencing the specified root folder - IshFolder[] array passed through the pipeline Query and Reference folders are not supported.\n\nThis PowerShell cmdlet has the following parameter sets to choose form where square brackets indicate optional parameters while the other parameters are mandatory:\nGet-IshFolder -FolderId [-Depth ] [-FolderTypeFilter {ISHNone | ISHModule | ISHMasterDoc | ISHLibrary | ISHTemplate | ISHIllustration | ISHPublication | ISHReference | ISHQuery}] [-IshSession ] [-Recurse ] [-RequestedMetadata ] []\r\n\r\nGet-IshFolder -FolderPath [-Depth ] [-FolderTypeFilter {ISHNone | ISHModule | ISHMasterDoc | ISHLibrary | ISHTemplate | ISHIllustration | ISHPublication | ISHReference | ISHQuery}] [-IshSession ] [-Recurse ] [-RequestedMetadata ] []\r\n\r\nGet-IshFolder -IshFolder [-Depth ] [-FolderTypeFilter {ISHNone | ISHModule | ISHMasterDoc | ISHLibrary | ISHTemplate | ISHIllustration | ISHPublication | ISHReference | ISHQuery}] [-IshSession ] [-Recurse ] [-RequestedMetadata ] []\r\n\r\nGet-IshFolder -BaseFolder {Data | System | Favorites | EditorTemplate} [-Depth ] [-FolderTypeFilter {ISHNone | ISHModule | ISHMasterDoc | ISHLibrary | ISHTemplate | ISHIllustration | ISHPublication | ISHReference | ISHQuery}] [-IshSession ] [-Recurse ] [-RequestedMetadata ] []\n\nThe PowerShell cmdlet has the following examples as inspiration:\n---------- EXAMPLE 1 ----------\r\n\r\n$ishSession = New-IshSession -WsBaseUrl \"https://example.com/ISHWS/\" -PSCredential Admin\r\nGet-IshFolder -FolderPath \"\\General\\__ISHRemote\\Add-IshPublicationOutput\\Pub\"\r\n\r\nNew-IshSession will submit into SessionState, so it can be reused by this cmdlet. Returns the IshFolder object.\r\n---------- EXAMPLE 2 ----------\r\n\r\n$ishSession = New-IshSession -WsBaseUrl \"https://example.com/ISHWS/\" -PSCredential Admin\r\n(Get-IshFolder -BaseFolder Data).name\r\n\r\nNew-IshSession will submit into SessionState, so it can be reused by this cmdlet. Returns the name of the root data folder, typically called 'General'.\r\n---------- EXAMPLE 3 ----------\r\n\r\n$ishSession = New-IshSession -WsBaseUrl \"https://example.com/ISHWS/\" -PSCredential \"Admin\"\r\n$requestedMetadata = Set-IshMetadataFilterField -Name \"FNAME\" -Level \"None\"\r\n$folderId = 7598 # provide a real folder identifier\r\n$ishFolder = Get-IshFolder -FolderId $folderId -RequestedMetaData $requestedMetadata\r\n$retrievedFolderName = $ishFolder.name\r\n\r\nGet folder name using Id with explicit requested metadata\r\n---------- EXAMPLE 4 ----------\r\n\r\n$ishSession = New-IshSession -WsBaseUrl \"https://example.com/ISHWS/\" -PSCredential \"Admin\"\r\n$ishFolders = Get-IshFolder -FolderPath \"General\\Myfolder\" -FolderTypeFilter @(\"ISHModule\", \"ISHMasterDoc\", \"ISHLibrary\") -Recurse\r\n\r\nGet folders recursively with filtering on folder type\r\n---------- EXAMPLE 5 ----------\r\n\r\nNew-IshSession -WsBaseUrl \"https://example.com/ISHWS/\"\r\n$imageCount = 0\r\n$xmlCount = 0\r\nGet-IshFolder -FolderPath \"General\\Myfolder\" -FolderTypeFilter @(\"ISHIllustration\", \"ISHModule\", \"ISHMasterDoc\", \"ISHLibrary\") -Recurse | \r\nGet-IshFolderContent -VersionFilter \"\" | \r\nForEach-Object -Process { \r\n if ($_.IshType -in @(\"ISHIllustration\")) { ++$imageCount }\r\n if ($_.IshType -in @(\"ISHModule\", \"ISHMasterDoc\", \"ISHLibrary\")) { ++$xmlCount }\r\n}\r\nWrite-Host (\"imageCount[\"+$imageCount+\"]\")\r\nWrite-Host (\"xmlCount[\"+$xmlCount+\"]\")\r\n\r\nVarious statistics can be gathered by crawling across many API calls. This sample recursively goes over some subfolder, and retrieves all content objects in the folder and aggregates to a rough count. The ForEach-Object construct is important as it only keeps the essence, the counters, and avoids keeping all objects retrieved over the API in memory - potentially running out of client-side/PowerShell memory.\r\n---------- EXAMPLE 6 ----------\r\n\r\nNew-IshSession -WsBaseUrl \"https://example.com/ISHWS/\"\r\n$metadataFilter = Set-IshMetadataFilterField -Level Lng -Name FISHPUBSTATUS -ValueType Element -FilterOperator In -Value VPUBSTATUSUNPUBLISHFAILED\r\n$ishObjects = Get-IshFolder -BaseFolder Data -FolderTypeFilter @(\"ISHPublication\") -Recurse | \r\n Get-IshFolderContent -IshFolder $ishFolders -VersionFilter LATEST -LanguagesFilter ('en-US','de-DE') -MetadataFilter $metadataFilter\r\n\r\nThis Get-IshFolder iteratively loops your repository folder structure and only passes Publication folders to the next cmdlet. Then Get-IshFolderContent cmdlet only retrieves LATEST versions of Publications with a languages filter and metadata filter.","annotations":{"type":"object","destructiveHint":"false","idempotentHint":"true","readOnlyHint":"true"},"inputSchema":{"type":"object","properties":{"BaseFolder":{"type":"string","description":"The BaseFolder enumeration to get subfolders for the specified root folder\r\n\r\n\r\nPossible values: Data, System, Favorites, EditorTemplate"},"Depth":{"type":"number","description":"Perform recursive retrieval of up to Depth of the provided incoming folder(s)"},"FolderId":{"type":"number","description":"Unique folder identifier"},"FolderPath":{"type":"string","description":"Separated string with the full folder path, e.g. \"General\\Project\\Topics\""},"FolderTypeFilter":{"type":"string","description":"Recursive retrieval will loop all folder, this filter will only return folder matching the filter to the pipeline\r\n\r\n\r\nPossible values: ISHNone, ISHModule, ISHMasterDoc, ISHLibrary, ISHTemplate, ISHIllustration, ISHPublication, ISHReference, ISHQuery"},"IshFolder":{"type":"string","description":"Folders for which to retrieve the metadata. This array can be passed through the pipeline or explicitly passed via the parameter."},"IshSession":{"type":"string","description":"The IshSession variable holds the authentication and contract information. This object can be initialized using the New-IshSession cmdlet."},"Recurse":{"type":"boolean","description":"Perform recursive retrieval of the provided incoming folder(s)"},"RequestedMetadata":{"type":"string","description":"The metadata fields to retrieve"}},"required":[]},"returns":{"type":"string","description":"Get-IshFolder"}} "@ | ConvertFrom-Json #NAME - $resultJson.name | Should -Be $expectedJson.name + $resultJson.name | Should-Be $expectedJson.name #DESCRIPTION or SYNOPSIS - $resultJson.description -like 'The Get-IshFolder cmdlet retrieves metadata for the folders by providing one of the following input data*' | Should -Be $true + $resultJson.description -like 'The Get-IshFolder cmdlet retrieves metadata for the folders by providing one of the following input data*' | Should-Be $true #EXAMPLES - $resultJson.description -like '*PowerShell cmdlet has the following examples as inspiration*' | Should -Be $true + $resultJson.description -like '*PowerShell cmdlet has the following examples as inspiration*' | Should-Be $true #SYNTAX or PARAMETER SETS - $resultJson.description -like '*This PowerShell cmdlet has the following parameter sets to choose form where square brackets indicate optional parameters while the other parameters are mandatory*' | Should -Be $true + $resultJson.description -like '*This PowerShell cmdlet has the following parameter sets to choose form where square brackets indicate optional parameters while the other parameters are mandatory*' | Should-Be $true #PARAMETERS - $resultJson.inputSchema.properties.IShSession.type | Should -Be $expectedJson.inputSchema.properties.IShSession.type - $resultJson.inputSchema.properties.IShSession.description | Should -Be $expectedJson.inputSchema.properties.IShSession.description + $resultJson.inputSchema.properties.IShSession.type | Should-Be $expectedJson.inputSchema.properties.IShSession.type + $resultJson.inputSchema.properties.IShSession.description | Should-Be $expectedJson.inputSchema.properties.IShSession.description #OUTPUT - $resultJson.returns.type | Should -Be $expectedJson.returns.type + $resultJson.returns.type | Should-Be $expectedJson.returns.type } It "Partial Load of Get-IshFolder cmdlet" { $resultJson = Register-IshRemoteMcpTool -FunctionNameFullLoad @() -FunctionNamePartialLoad @('Get-IshFolder') | ConvertFrom-Json @@ -44,26 +44,26 @@ Describe "Register-IshRemoteMcpTool" -Tags "Read" -Skip:($PSVersionTable.PSVersi {"name":"Get-IshFolder","description":"The Get-IshFolder cmdlet retrieves metadata for the folders by providing one of the following input data: - FolderPath string with the separated full folder path - FolderIds array containing identifiers of the folders - BaseFolder enum value referencing the specified root folder - IshFolder[] array passed through the pipeline Query and Reference folders are not supported.","annotations":{"type":"object","destructiveHint":"false","idempotentHint":"true","readOnlyHint":"true"},"inputSchema":{"type":"object","properties":{},"required":[]},"returns":{"type":"string","description":"Get-IshFolder"}} "@ | ConvertFrom-Json #NAME - $resultJson.name | Should -Be $expectedJson.name + $resultJson.name | Should-Be $expectedJson.name #DESCRIPTION or SYNOPSIS - $resultJson.description -like 'The Get-IshFolder cmdlet retrieves metadata for the folders by providing one of the following input data*' | Should -Be $true + $resultJson.description -like 'The Get-IshFolder cmdlet retrieves metadata for the folders by providing one of the following input data*' | Should-Be $true #EXAMPLES - $resultJson.description -notlike '*PowerShell cmdlet has the following examples as inspiration*' | Should -Be $true + $resultJson.description -notlike '*PowerShell cmdlet has the following examples as inspiration*' | Should-Be $true #SYNTAX or PARAMETER SETS - $resultJson.description -notlike '*This PowerShell cmdlet has the following parameter sets to choose form where square brackets indicate optional parameters while the other parameters are mandatory*' | Should -Be $true + $resultJson.description -notlike '*This PowerShell cmdlet has the following parameter sets to choose form where square brackets indicate optional parameters while the other parameters are mandatory*' | Should-Be $true #PARAMETERS - $resultJson.inputSchema.properties.ToString().Length | Should -Be 0 + $resultJson.inputSchema.properties.ToString().Length | Should-Be 0 #OUTPUT - $resultJson.returns.type | Should -Be $expectedJson.returns.type + $resultJson.returns.type | Should-Be $expectedJson.returns.type } It "Full Load of all ISHRemote cmdlets (>100k characters like 288225)" { $resultString = Register-IshRemoteMcpTool -FunctionNameFullLoad (Get-Command -Module ISHRemote -ListImported -CommandType Cmdlet).Name - $resultString.Length -gt 100000 | Should -Be $true + $resultString.Length -gt 100000 | Should-Be $true } It "Partial Load of all ISHRemote cmdlets (<100k characters like 44603)" { $resultString = Register-IshRemoteMcpTool -FunctionNamePartialLoad (Get-Command -Module ISHRemote -ListImported -CommandType Cmdlet).Name - $resultString.Length -gt 10000 | Should -Be $true - $resultString.Length -lt 100000 | Should -Be $true + $resultString.Length -gt 10000 | Should-Be $true + $resultString.Length -lt 100000 | Should-Be $true } } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/Start-IshRemoteMcpServer.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/Start-IshRemoteMcpServer.Tests.ps1 index 99bb266..e1a001a 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/Start-IshRemoteMcpServer.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Scripts/Public/Start-IshRemoteMcpServer.Tests.ps1 @@ -1,3 +1,4 @@ +#pester:no-parallel #Mock -ModuleName uses cross-module mocking which installs hooks into the ISHRemote module's session state. In a parallel runspace, each worker loads its own ISHRemote module instance, but the mock infrastructure that Mock -ModuleName relies on requires the parent session's module context. This causes the worker runspace to hang waiting for something that never resolves. BeforeAll { $cmdletName = "Start-IshRemoteMcpServer" Write-Host ("`r`nLoading ISHRemote.PesterSetup.ps1 on PSVersion[" + $psversionTable.PSVersion + "] over BeforeAll-block for MyCommand[" + $cmdletName + "]...") @@ -17,7 +18,7 @@ Describe "Start-IshRemoteMcpServer" -Tags "Read" -Skip:($PSVersionTable.PSVersio Mock -ModuleName ISHRemote Write-IshRemoteLog { } } It "Validates CmdletsToRegister parameter is mandatory" { - { Start-IshRemoteMcpServer -ActivateWhileLoop $false -CmdletsToRegister @() } | Should -Throw + { Start-IshRemoteMcpServer -ActivateWhileLoop $false -CmdletsToRegister @() } | Should-Throw } It "Starts server with CmdletsToRegister parameter" { $cmdlets = @('Get-IshFolder', 'Set-IshFolder') @@ -32,7 +33,7 @@ Describe "Start-IshRemoteMcpServer" -Tags "Read" -Skip:($PSVersionTable.PSVersio Mock -ModuleName ISHRemote Register-IshRemoteMcpTool { return "{}" } $cmdlets = @('Get-IshFolder') Start-IshRemoteMcpServer -CmdletsToRegister $cmdlets -ActivateWhileLoop $false - Should -Invoke -ModuleName ISHRemote Register-IshRemoteMcpTool -ParameterFilter { + Should-Invoke -ModuleName ISHRemote Register-IshRemoteMcpTool -ParameterFilter { $FunctionNameFullLoad -contains 'Get-Help' -and $FunctionNameFullLoad -contains 'New-IshSession' } } @@ -41,7 +42,7 @@ Describe "Start-IshRemoteMcpServer" -Tags "Read" -Skip:($PSVersionTable.PSVersio $cmdlets = @('Get-IshFolder') $cmdletsFullLoad = @('Get-IshDocumentObj', 'Set-IshDocumentObj') Start-IshRemoteMcpServer -CmdletsToRegister $cmdlets -CmdletsToRegisterFullLoad $cmdletsFullLoad -ActivateWhileLoop $false - Should -Invoke -ModuleName ISHRemote Register-IshRemoteMcpTool -ParameterFilter { + Should-Invoke -ModuleName ISHRemote Register-IshRemoteMcpTool -ParameterFilter { $FunctionNameFullLoad -contains 'Get-IshDocumentObj' -and $FunctionNameFullLoad -contains 'Set-IshDocumentObj' -and -not ($FunctionNameFullLoad -contains 'Get-Help') -and -not ($FunctionNameFullLoad -contains 'New-IshSession') } } @@ -54,8 +55,8 @@ Describe "Start-IshRemoteMcpServer" -Tags "Read" -Skip:($PSVersionTable.PSVersio # the fix in GitHub issue #243. $cmdlets = @('Get-IshFolder') Start-IshRemoteMcpServer -CmdletsToRegister $cmdlets -ActivateWhileLoop $false - [Console]::InputEncoding.WebName | Should -Be 'utf-8' - [Console]::OutputEncoding.WebName | Should -Be 'utf-8' + [Console]::InputEncoding.WebName | Should-Be 'utf-8' + [Console]::OutputEncoding.WebName | Should-Be 'utf-8' } It "Sets Console Out AutoFlush to true on inner StreamWriter" { # Console.SetOut re-wraps in SyncTextWriter; verify the inner StreamWriter has AutoFlush=true @@ -65,26 +66,7 @@ Describe "Start-IshRemoteMcpServer" -Tags "Read" -Skip:($PSVersionTable.PSVersio Start-IshRemoteMcpServer -CmdletsToRegister $cmdlets -ActivateWhileLoop $false $field = [Console]::Out.GetType().GetField('_out', [System.Reflection.BindingFlags]::NonPublic -bor [System.Reflection.BindingFlags]::Instance) $innerWriter = $field.GetValue([Console]::Out) - $innerWriter.AutoFlush | Should -Be $true - } - } - Context "Start-IshRemoteMcpServer with ActivateWhileLoop=true and stdin EOF" { - BeforeEach { - Mock -ModuleName ISHRemote Write-IshRemoteLog { } - } - It "Exits cleanly when stdin is closed (EOF) instead of looping forever" { - # Regression test for GitHub issue #243: ReadLine() returns $null on EOF. - # Replace Console.In with an empty StringReader so the first ReadLine() returns $null, - # simulating the MCP client closing the input stream. The server must exit promptly. - $cmdlets = @('Get-IshFolder') - $originalIn = [Console]::In - try { - [Console]::SetIn([System.IO.StringReader]::new("")) - { Start-IshRemoteMcpServer -CmdletsToRegister $cmdlets -ActivateWhileLoop $true } | Should -Not -Throw - } - finally { - [Console]::SetIn($originalIn) - } + $innerWriter.AutoFlush | Should-Be $true } } }