Asserts an object is false.
Assert-False [[-InputObject] <Object>] [[-Message] <String>] [<CommonParameters>]
Uses PowerShell's rules for determinig truthiness. The following objects evaluate to $false
:
0
$false
[String]::Empty
)$null
@()
(i.e. empty arrays)All other values are true.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
InputObject | Object | The value to check. |
false | false | |
Message | String | A description about why the assertion might fail. |
false | false |
Assert-False $true
Demonstrates how to fail a test.
Assert-False (Invoke-SomethingThatShouldFail)
Demonstrates how to check that a function returns a true object/value.
Assert-False $true 'The fladoozle didn't dooflaple.'
Demonstrates how to use the Message
parameter to describe why the assertion might have failed.