-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
featureNew functionalityNew functionality
Milestone
Description
Take the code sample from
DemoPsModuleTest/public/Tests-publish.ps1#Assert-ContainsPattern
function Assert-ContainsPattern{
[CmdletBinding()]
param (
[Parameter(Mandatory)] [string] $Expected,
[Parameter(Mandatory)] [string[]] $Presented,
[Parameter()] [string] $Comment
)
$found = $false
foreach($p in $Presented){
if ($p -like $Expected) {
$found = $true
break
}
}
Assert-IsTrue -Condition $found -Comment "Not found pattern [$Expected] in $Presented - $Comment "
}
function Assert-ContainsNotPattern{
[CmdletBinding()]
param (
[Parameter(Mandatory)] [string] $Expected,
[Parameter(Mandatory)] [string[]] $Presented,
[Parameter()] [string] $Comment
)
$found = $false
foreach($p in $Presented){
if ($p -like $Expected) {
$found = $true
break
}
}
Assert-IsFalse -Condition $found -Comment "Found pattern [$Expected] in $Presented - $Comment"
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew functionalityNew functionality