Asserts that an object isn't $null
.
Assert-NotNull [[-InputObject] <Object>] [[-Message] <String>] [<CommonParameters>]
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
InputObject | Object | The object to check. |
false | false | |
Message | String | A reason why the assertion fails. |
false | false |
Assert-NotNull $null
Demonstrates how to fail a test by asserting that $null
isn't $null
.
Assert-NotNull $object 'The foo didn''t bar!'
Demonstrates how to give a descriptive error about why the assertion might be failing.