Asserts that an object is a specific type.
Assert-Is [[-InputObject] <Object>] [[-ExpectedType] <Type>] [[-Message] <String>] [<CommonParameters>]
Uses PowerShell's -is
operator to check that InputObject
is the ExpectedType
type.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
InputObject | Object | The object whose type to check. |
false | false | |
ExpectedType | Type | The expected type of the object. |
false | false | |
Message | String | A message to show when the assertion fails. |
false | false |
Assert-Is 'foobar' ([string])
Demonstrates how to assert an object is of a specific type.
Assert-Is 1 'double' 'Not enough decimals!'
Demonstrates how to show a message describing why the test might fail.