< Back
Assert-NotNull
Post
NAME Assert-NotNull
SYNOPSIS
Asserts that an object isn't `$null`.
SYNTAX
Assert-NotNull [[-InputObject] <Object>] [[-Message] <String>] [<CommonParameters>]
DESCRIPTION
PARAMETERS
-InputObject <Object>
The object to check.
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Message <String>
A reason why the assertion fails.
Required? false
Position? 2
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-NotNull $null
Demonstrates how to fail a test by asserting that `$null` isn't `$null`.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Assert-NotNull $object 'The foo didn''t bar!'
Demonstrates how to give a descriptive error about why the assertion might be failing.
RELATED LINKS
SYNOPSIS
Asserts that an object isn't `$null`.
SYNTAX
Assert-NotNull [[-InputObject] <Object>] [[-Message] <String>] [<CommonParameters>]
DESCRIPTION
PARAMETERS
-InputObject <Object>
The object to check.
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Message <String>
A reason why the assertion fails.
Required? false
Position? 2
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-NotNull $null
Demonstrates how to fail a test by asserting that `$null` isn't `$null`.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Assert-NotNull $object 'The foo didn''t bar!'
Demonstrates how to give a descriptive error about why the assertion might be failing.
RELATED LINKS