Last active
February 28, 2017 14:48
-
-
Save nohwnd/52c121c9a067bc26791b2c9065aebfaf to your computer and use it in GitHub Desktop.
Should Be NullOrEmpty
This file contains 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
We are comparing if two values are equal so | |
when $Expected is string with value 'NullOrEmpty' | |
and $Actual is $null then the result is: | |
False | |
We are comparing if two values are equal so | |
when $Expected is string with value 'NullOrEmpty' | |
and Actual is string with value 'NullOrEmpty' then the result is: | |
True |
This file contains 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
function Should-Be { | |
param($Expected,[Parameter(ValueFromPipeline)]$Actual) | |
"We are comparing if two values are equal so" | |
"when `$Expected is $($Expected.GetType()) with value '$Expected'" | |
if ($null -eq $Actual) | |
{ | |
"and `$Actual is `$null then the result is:" | |
} | |
else | |
{ | |
"and Actual is $($Actual.GetType()) with value '$Actual' then the result is:" | |
} | |
$Expected -Eq $Actual | |
"`n" | |
} | |
$null | Should-Be NullOrEmpty | |
"NullOrEmpty" | Should-Be NullOrEmpty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment