[CmdletBinding()] param( [string]$ApiBaseUrl = 'http://localhost:5286/api', [string]$BgwRoot = ('F:\Kunden Auftr' + [char]0x00E4 + 'ge\BGW'), [string]$DeploymentBatchId = '80000000-0000-0000-0000-000000000101', [string]$MergeModulePath = 'F:\Projekte\Coding\PowerShell\Merge-DSCConfigurationData\Merge-DSCConfigurationData.psd1', [string]$ResolveModulePath = 'F:\Projekte\Coding\PowerShell\Resolve-DSCConfigurationData\Resolve-DSCConfigurationData.psd1', [int]$ApiTimeoutSec = 30, [switch]$UseDefaultCredentials = $true ) $ErrorActionPreference = 'Stop' $testPath = Join-Path -Path $PSScriptRoot -ChildPath 'BgwMerge.Api.Tests.ps1' if (-not (Test-Path -LiteralPath $testPath -PathType Leaf)) { throw "Pester test file [$testPath] was not found." } if (-not (Get-Command Invoke-Pester -ErrorAction SilentlyContinue)) { throw 'Pester is required. Install-Module Pester or run this on a machine where Pester is available.' } $parameters = @{ ApiBaseUrl = $ApiBaseUrl BgwRoot = $BgwRoot DeploymentBatchId = $DeploymentBatchId MergeModulePath = $MergeModulePath ResolveModulePath = $ResolveModulePath ApiTimeoutSec = $ApiTimeoutSec UseDefaultCredentials = [bool]$UseDefaultCredentials } $result = Invoke-Pester -Script @{ Path = $testPath; Parameters = $parameters } -PassThru if ($result.FailedCount -gt 0) { throw "Pester test run failed. Passed=[$($result.PassedCount)] Failed=[$($result.FailedCount)] Skipped=[$($result.SkippedCount)]." }