< Back

Assert-ContainsNotLike

Sun Jan 12, 2020 5:34 pm

NAME Assert-ContainsNotLike



SYNOPSIS

Asserts that a collections doesn't contain an item, using wildcards when comparing.





SYNTAX

Assert-ContainsNotLike [[-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 that the collection doesn't contain. 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-ContainsNotLike @( 'foo', 'bar', 'baz' ) '*z'



Demonstrates how to check if a collection doesn't contain an item, using wildcards when comparing.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Assert-ContainsNotLike @( 'foo', 'bar' ) '*az' 'No az!'



Demonstrates how to supply your own message when the assertion fails.











RELATED LINKS