< Back
Assert-ContainsLike
Post
NAME Assert-ContainsLike
SYNOPSIS
Asserts that a collections contains an item, using wildcards to check.
SYNTAX
Assert-ContainsLike [[-Haystack] <Object>] [[-Needle] <Object>] [[-Message] <String>] [<CommonParameters>]
DESCRIPTION
Compares each item in a collection for a value using PowerShell's `-like` operator.
PARAMETERS
-Haystack <Object>
The collection to check.
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Needle <Object>
The object to check the collection for. Wildcards supported.
Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Message <String>
A message to show when the assertion fails.
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Assert-ContainsLike @( 'foo', 'bar', 'baz' ) 'b*'
Demonstrates how to check if a collection contains an item, using wildcards when doing the comparison.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Assert-ContainsLike @( 'foo', 'bar' ) '*z' 'No Z!'
Demonstrates how to supply your own message when the assertion fails.
RELATED LINKS
SYNOPSIS
Asserts that a collections contains an item, using wildcards to check.
SYNTAX
Assert-ContainsLike [[-Haystack] <Object>] [[-Needle] <Object>] [[-Message] <String>] [<CommonParameters>]
DESCRIPTION
Compares each item in a collection for a value using PowerShell's `-like` operator.
PARAMETERS
-Haystack <Object>
The collection to check.
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Needle <Object>
The object to check the collection for. Wildcards supported.
Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Message <String>
A message to show when the assertion fails.
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Assert-ContainsLike @( 'foo', 'bar', 'baz' ) 'b*'
Demonstrates how to check if a collection contains an item, using wildcards when doing the comparison.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Assert-ContainsLike @( 'foo', 'bar' ) '*z' 'No Z!'
Demonstrates how to supply your own message when the assertion fails.
RELATED LINKS