https://github.com/stuartleeks/pestermatchhashtable
Hashtable assertions for Pester
https://github.com/stuartleeks/pestermatchhashtable
powershell testing
Last synced: 5 months ago
JSON representation
Hashtable assertions for Pester
- Host: GitHub
- URL: https://github.com/stuartleeks/pestermatchhashtable
- Owner: stuartleeks
- License: mit
- Created: 2016-07-11T19:32:52.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-10-08T21:06:59.000Z (over 6 years ago)
- Last Synced: 2025-04-10T15:49:37.567Z (10 months ago)
- Topics: powershell, testing
- Language: PowerShell
- Size: 8.79 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PesterMatchHashtable
This module provides additional assertions for [Pester](https://github.com/pester/Pester) to help with testing hash table contents
Also see [PesterMatchArray](https://github.com/stuartleeks/PesterMatchArray) for array assertions.
[](https://ci.appveyor.com/project/stuartleeks/pestermatchhashtable/branch/master)
## Installation
### PowerShell Gallery
You can install [PesterMatchHashtable](https://www.powershellgallery.com/packages/PesterMatchHashtable/) via the [PowerShell Gallery](https://www.powershellgallery.com/)
```powershell
Install-Module -Name PesterMatchHashtable
```
## Examples
MatchHashtable compares two hashtables.
```powershell
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