Assert-False

Asserts an object is false.

Syntax

Assert-False [[-InputObject] <Object>] [[-Message] <String>] [<CommonParameters>]

Description

Uses PowerShell's rules for determinig truthiness. The following objects evaluate to $false:

All other values are true.

Parameters

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

EXAMPLE 1

Assert-False $true

Demonstrates how to fail a test.

EXAMPLE 2

Assert-False (Invoke-SomethingThatShouldFail)

Demonstrates how to check that a function returns a true object/value.

EXAMPLE 3

Assert-False $true 'The fladoozle didn't dooflaple.'

Demonstrates how to use the Message parameter to describe why the assertion might have failed.