Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function dummy {
- return Get-Date -f "dd"
- }
- $here = Split-Path -Parent $MyInvocation.MyCommand.Path
- $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '.Tests.', '.'
- . "$here$sut"
- Describe "dummy" {
- Mock Get-Date { return "01" } -Verifiable -ParameterFilter {$f -match "dd"}
- It "does something useful" {
- dummy
- Assert-VerifiableMocks
- }
- }
- Describing dummy
- [-] does something useful 99ms
- RuntimeException: Expected Get-Date to be called with $f -match "dd"
- at Assert-VerifiableMocks, C:Program FilesWindowsPowerShellModulesPester3.4.0FunctionsMock.ps1: line 434
- at <ScriptBlock>, E:…dummy.Tests.ps1: line 11
- Tests completed in 99ms
- Passed: 0 Failed: 1 Skipped: 0 Pending: 0 Inconclusive: 0
- Name Value
- ---- -----
- PSVersion 5.1.14393.1198
- PSEdition Desktop
- PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
- BuildVersion 10.0.14393.1198
- CLRVersion 4.0.30319.42000
- WSManStackVersion 3.0
- PSRemotingProtocolVersion 2.3
- SerializationVersion 1.1.0.1
- Mock Get-Date { return "01" } -Verifiable -ParameterFilter {$format -match "dd"}
- Describing dummy
- [+] does something useful 31ms
Add Comment
Please, Sign In to add comment