NAME
New-Fixture
SYNOPSIS
This function generates two scripts, one that defines a function and another one that contains its tests.SYNTAX
New-Fixture [[-Path]
] [-Name] [ ] DESCRIPTION
This function generates two scripts, one that defines a function and another one that contains its tests. The files are by default placed in the current directory and are called and populated as such: The script defining the function: .\Clean.ps1: function Clean { } The script containg the example test .\Clean.Tests.ps1:$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
. "$here\$sut"
Describe "Clean" { It "does something useful" {$false | Should Be $true
} }PARAMETERS
-Path
Defines path where the test and the function should be created, you can use full or relative path. If the parameter is not specified the scripts are created in the current directory. Required? false Position? 1Default value $PWD
Accept pipeline input? false Accept wildcard characters? false-Name
Defines the name of the function and the name of the test to be created. Required? true Position? 2 Default value Accept pipeline input? false Accept wildcard characters? falseThis cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\>New-Fixture -Name Clean
Creates the scripts in the current directory.-------------------------- EXAMPLE 2 --------------------------
PS C:\>New-Fixture C:\Projects\Cleaner Clean
Creates the scripts in the C:\Projects\Cleaner directory.-------------------------- EXAMPLE 3 --------------------------
PS C:\>New-Fixture Cleaner Clean
Creates a new folder named Cleaner in the current directory and creates the scripts in it.RELATED LINKS
Describe Context It about_Pester about_Should