Functions/Assertions/Contain.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14

function PesterContain($file, $contentExpecation) {
    return ((Get-Content -Encoding UTF8 $file) -match $contentExpecation)
}

function PesterContainFailureMessage($file, $contentExpecation) {
    return "Expected: file ${file} to contain {$contentExpecation}"
}

function NotPesterContainFailureMessage($file, $contentExpecation) {
    return "Expected: file {$file} to not contain ${contentExpecation} but it did"
}