functions/TestingUtils.ps1

# Small utility for testing whether objects have the same properties
Function Assert-PropertiesMatch {
  Param (
    $Expected,
    $Actual
  )
  Process {
    foreach ($prop in ($Expected.psobject.properties.name)) {

      if ($Expected."$prop".GetType().Name -eq "DateTime") {
        [string]$Actual."$prop".ToString() | Should -Be $Expected."$prop".ToString()
      }
      else {
        [string]$Actual."$prop" | Should -Be $Expected."$prop"
      }
    }
  }
}