TestDrive

When testing commands that work with the filesystem, Pester provides a TestDrive. The TestDrive is a temporary folder created in the current user's temporary directory.

The folder is created when describe runs and is destroyed afterwards.

Using the TestDrive would simplify the setup process for the Remove-StaleFile function, for example, BeforeAll might become:

    BeforeAll { 
        $extensions = '.txt', '.log', '.doc' 
        Push-Location 'TestDrive:' 
    } 

And AfterAll becomes:

    AfterAll { 
        Pop-Location 
    } 

In the event that a command cannot work with the TestDrive label, as is the case with .NET types and methods, as well as native executables, the full path can be resolved using Get-Item:

(Get-Item 'TestDrive:').FullName 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.93.169