Hi,
I how can I mock Get-Date? below code does not work but if I change the mock commandname to Get-Test it works.
Should the below code work?
Thanks.
Function Get-Test {
Get-Date
}
Describe 'whatever' {
Context 'test getdate'{
it 'date should be dec1'{
$Date = Get-Date 12/01/2019
mock -CommandName Get-Date -MockWith {$Date}
Get-Test | Should -Be $Date
}
}
}