< Back
Assert-Equal
Post
NAME Assert-Equal
SYNOPSIS
Asserts that two objects are equal.
SYNTAX
Assert-Equal [[-Expected] <Object>] [[-Actual] <Object>] [[-Message] <String>] [-CaseSensitive]
[<CommonParameters>]
DESCRIPTION
Uses PowerShell's `-eq` operator to test if two objects are equal. To perform a case-sensitive comparison with
the `-ceq` operator, use the `-CaseSensitive` switch.
PARAMETERS
-Expected <Object>
The expected value.
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Actual <Object>
The actual value.
Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Message <String>
A message to show when the assertion fails.
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
-CaseSensitive [<SwitchParameter>]
Performs a case-sensitive equality comparison.
Required? false
Position? named
Default value False
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-Equal 'foo' 'FOO'
Demonstrates that the equality is case-insensitive.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Assert-Equal 'foo' 'FOO' -CaseSensitive
Demonstrates that the equality is case-insensitive.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Assert-Equal 'foo' 'bar' 'The bar didn''t foo!'
Demonstrates how to include your own message when the assertion fails.
RELATED LINKS
SYNOPSIS
Asserts that two objects are equal.
SYNTAX
Assert-Equal [[-Expected] <Object>] [[-Actual] <Object>] [[-Message] <String>] [-CaseSensitive]
[<CommonParameters>]
DESCRIPTION
Uses PowerShell's `-eq` operator to test if two objects are equal. To perform a case-sensitive comparison with
the `-ceq` operator, use the `-CaseSensitive` switch.
PARAMETERS
-Expected <Object>
The expected value.
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Actual <Object>
The actual value.
Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Message <String>
A message to show when the assertion fails.
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
-CaseSensitive [<SwitchParameter>]
Performs a case-sensitive equality comparison.
Required? false
Position? named
Default value False
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-Equal 'foo' 'FOO'
Demonstrates that the equality is case-insensitive.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Assert-Equal 'foo' 'FOO' -CaseSensitive
Demonstrates that the equality is case-insensitive.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Assert-Equal 'foo' 'bar' 'The bar didn''t foo!'
Demonstrates how to include your own message when the assertion fails.
RELATED LINKS