Private/Tests/_StartAllTests.ps1

# ? TITEL Startet alle AKPT-Tests
# ? DESCRIPTION Zentraler Starter für alle Pester UTest (Cmdlets und Module).
# ? TAGS UTest Pester Module
# ? VERSION 2020.01.14

#region Prolog

using Module CimCmdlets
using Module Microsoft.PowerShell.Security
using Module Microsoft.WSMan.Management
using Module Pester
using Module PSScriptAnalyzer
Set-StrictMode -Version Latest
$testScriptPath = Split-Path -Path $MyInvocation.MyCommand.Path

#endregion

# ! UTest inkl. Code-Abdeckung ausführen
$UTestsFullName = Get-ChildItem -Path "$testScriptPath\*-*.Tests.ps1" -File | Select-Object -ExpandProperty FullName
$cmdletsFullName = ($UTestsFullName -replace ".Test.", [String]::Empty) -replace "Private", "Public"
$UTestsFullName += "$testScriptPath\AKPT.Tests.ps1" # zzgl. Module-Test
$cmdletTestResult = Invoke-Pester -Script $UTestsFullName -CodeCoverage $cmdletsFullName -Show All -PassThru 
$cmdletTestResult.TestResult | Where-Object Passed -EQ $False