Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement