Functions/Assertions/Contain.ps1

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

function PesterContain($file, $contentExpectation) {
    return ((& $SafeCommands['Get-Content'] -Encoding UTF8 $file) -match $contentExpectation)
}

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

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