Skip to main content
Version: v6 (preview) 🚧

Get-EquivalencyOption

This page was generated

Contributions are welcome in Pester-repo.

SYNOPSIS​

Generates an object containing options for checking equivalency.

SYNTAX​

Get-EquivalencyOption [[-ExcludePath] <String[]>] [-ExcludePathsNotOnExpected] [[-Comparator] <String>]
[<CommonParameters>]

DESCRIPTION​

The Get-EquivalencyOption function creates a custom object with options that determine how equivalency between two objects is assessed. This can be used in scenarios where a deep comparison of objects is required, with the ability to exclude specific paths from the comparison and to choose between different comparison strategies.

EXAMPLES​

EXAMPLE 1​

$option = Get-EquivalencyOption -ExcludePath 'Id', 'Timestamp' -Comparator 'Equality'
This example generates an equivalency option object that excludes the 'Id' and 'Timestamp' properties from the comparison and uses a simple equality comparison strategy.

EXAMPLE 2​

$option = Get-EquivalencyOption -ExcludePathsNotOnExpected
This example generates an equivalency option object that excludes any paths not present on the expected object from the comparison, using the default deep comparison strategy.

PARAMETERS​

-ExcludePath​

An array of strings specifying the paths to exclude from the comparison. Each path should correspond to a property name or a chain of property names separated by dots for nested properties.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: @()
Accept pipeline input: False
Accept wildcard characters: False

-ExcludePathsNotOnExpected​

A switch parameter that, when set, excludes any paths from the comparison that are not present on the expected object. This is useful for ignoring extra properties on the actual object that are not relevant to the comparison.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Comparator​

Specifies the comparison strategy to use. The options are 'Equivalency' for a deep comparison that considers the structure and values of objects, and 'Equality' for a simple equality comparison. The default is 'Equivalency'.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: Equivalency
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters​

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS​

OUTPUTS​

NOTES​

https://pester.dev/docs/commands/Get-EquivalencyOption

https://pester.dev/docs/assertions

VERSION​

This page was generated using comment-based help in Pester 6.0.0-alpha1.