write-host -fore Green @'
Try running the following 3 commands in order:
Invoke-Pester ./zDemo.Tests.ps1 <--- it will fail saying "Mock for Invoke-RestMethod not found"
$env:AUTOMOCK_RECORD = $true
Invoke-Pester ./zDemo.Tests.ps1 <--- it will record the mocks and save them to your temp drive
Remove-Item env:AUTOMOCK_RECORD (and optionally, disconnect your network!)
Invoke-Pester ./zDemo.Tests.ps1 <--- It will succeed and run much faster because it is pulling from the offline cache!

Try again with $debugpreference='continue'
'@

. $PSScriptRoot/AutoMock.ps1
Describe "AutoMock Examples" {
    AutoMock Invoke-RestMethod
    It 'Records Slow Sites' {
        (Invoke-RestMethod -Uri 'http://slowwly.robertomurray.co.uk/delay/1000/url/http://ipinfo.io/4.2.2.2/json').timezone | Should -Be 'America/Chicago'
    }
    It 'Also works via pipeline' {
        @{test=5} | Invoke-RestMethod -method post -uri 'http://slowwly.robertomurray.co.uk/delay/1000/url/https://postman-echo.com/post' | % json | % test | should -be 5
    }
    It "Aliases that reference the original command get mocked too" {
        (irm 'http://slowwly.robertomurray.co.uk/delay/1000/url/http://ipinfo.io/4.2.2.2/json').postal | Should -Be '71203'
    }
}