Skip to content
Hashtable assertions for Pester
PowerShell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
Examples.ps1
LICENSE
PesterMatchHashtable.Tests.ps1
PesterMatchHashtable.ps1
PesterMatchHashtable.psd1
PesterMatchHashtable.psm1
Publish.ps1
README.md
RunPester.ps1
appveyor.yml

README.md

PesterMatchHashtable

This module provides additional assertions for Pester to help with testing hash table contents

Also see PesterMatchArray for array assertions.

Build status

Installation

PowerShell Gallery

You can install PesterMatchHashtable via the PowerShell Gallery

Install-Module -Name PesterMatchHashtable

Examples

MatchHashtable compares two hashtables.

Describe "MatchHashtable examples" {
	It "single item hashtables match" {
       @{"a"=1} | Should MatchHashtable @{"a"=1}
    }
    It "hashtables  with the same contents match" {
        @{"a"=1;"b"="wibble"} | Should MatchHashtable @{"b"="wibble";"a"=1}
    }
    It "hashtables with different lengths do not match" {
        @{"a"=1} | Should Not MatchHashtable @{"b"="wibble";"a"=1}
    }
    It "hashtables with different lengths do not match" {
        @{"a"=1;"b"="wibble"} | Should Not MatchHashtable @{"b"="wibble"}
    }
    It "hashtables with different values do not match" {
        @{"a"=1;"b"="wibble"} | Should Not MatchHashtable @{"a"=123; "b"="wibble"}
    }
}

Release Notes

Version 0.3.0 27th July 2017

Pushed to PowerShell Gallery

Updated to work with Pester v4 (tested on 4.0.5 pre-release)

Version 0.0.1 11th July 2016

Pushed to PowerShell Gallery

Initial version of PesterMatchHashtable

Future

  • Wrap up to publish to chocolatey, psget
You can’t perform that action at this time.