Assert-ContainsNotLike

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

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

EXAMPLE 1

Assert-ContainsNotLike @( 'foo', 'bar', 'baz' ) '*z'

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

EXAMPLE 2

Assert-ContainsNotLike @( 'foo', 'bar' ) '*az' 'No az!'

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