Dependencies/Axiom/Verify-NotSame.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function Verify-NotSame {
    param (
        [Parameter(ValueFromPipeline=$true)]
        $Actual,
        [Parameter(Mandatory=$true,Position=0)]
        $Expected
    )

    if ([object]::ReferenceEquals($Expected, $Actual)) {
        throw [Exception]"Expected the objects to be different instance but they were the same instance."
    }
    
    $Actual
}