Created
February 8, 2016 14:06
-
-
Save beatcracker/f8163ac1b8cdd449084c to your computer and use it in GitHub Desktop.
Compare function's internal properties (Adv. function vs Adv. function w/ CmdletBinding attribute)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -Path .\KellermanSoftware.Compare-NET-Objects.dll | |
$CompareLogic = New-Object -TypeName KellermanSoftware.CompareNetObjects.CompareLogic | |
$Config = @{ | |
MaxStructDepth = 999 | |
MaxDifferences = 999 | |
MaxByteArrayDifferences = 999 | |
} | |
$CompareLogic.Config = $Config | |
function Use-CmdletBindingWithAdvParam {[CmdletBinding()] Param([Parameter()]$Foo) @{MyInvocation = $MyInvocation ; PSCmdlet = $PSCmdlet}} | |
function Use-AdvParam {Param([Parameter()]$Foo) @{MyInvocation = $MyInvocation ; PSCmdlet = $PSCmdlet}} | |
$CmdletBindingWithAdvParam = Use-CmdletBindingWithAdvParam | |
$AdvParam = Use-AdvParam | |
$MyInvocationDiff = $CompareLogic.Compare($CmdletBindingWithAdvParam.MyInvocation, $AdvParam.MyInvocation).Differences | Where-Object {$_.PropertyName -notlike '.MyCommand.ScriptBlock.Ast*'} | |
$PSCmdletDiff = $CompareLogic.Compare($CmdletBindingWithAdvParam.PSCmdlet, $AdvParam.PSCmdlet).Differences |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment