SHARE
TWEET

Untitled

a guest Jun 18th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Assert-ArrayEquality($test, $expected) {
  2.     $test | Should -HaveCount $expected.Count
  3.     0..($test.Count - 1) | % {$test[$_] | Should -Be $expected[$_]}
  4. }
  5.  
  6. function Assert-HashtableEquality($test, $expected) {
  7.     $test.Keys | Should -HaveCount $expected.Keys.Count
  8.     $test.Keys | % {$test[$_] | Should -Be $expected[$_]}
  9. }
  10.  
  11. function Assert-ObjectEquality($test, $expected) {
  12.     $testKeys = $test.psobject.Properties | % Name
  13.     $expectedKeys = $test.psobject.Properties | % Name
  14.     $testKeys | Should -HaveCount $expectedKeys.Count
  15.     $testKeys | % {$test.$_ | Should -Be $expected.$_}
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top