Asserts that a collections doesn't contain an item, using wildcards when comparing.
Assert-ContainsNotLike [[-Haystack] <Object>] [[-Needle] <Object>] [[-Message] <String>] [<CommonParameters>]
Compares each item in a collection for a value using PowerShell's -like
operator.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
Haystack | Object | The collection to check. |
false | false | |
Needle | Object | The object to check that the collection doesn't contain. Wildcards supported. |
false | false | |
Message | String | A message to show when the assertion fails. |
false | false |
Assert-ContainsNotLike @( 'foo', 'bar', 'baz' ) '*z'
Demonstrates how to check if a collection doesn't contain an item, using wildcards when comparing.
Assert-ContainsNotLike @( 'foo', 'bar' ) '*az' 'No az!'
Demonstrates how to supply your own message when the assertion fails.