forked from jonwagner/PSate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Create-TestProject.ps1
44 lines (43 loc) · 1.3 KB
/
Create-TestProject.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
$scriptDirectory = Split-Path $MyInvocation.MyCommand.Path
<#
.Synopsis
Generates Test Project with two files: One that defines a function and another one that contains its tests.
.DESCRIPTION
Generates Test Project with two files: One that defines a function and another one that contains its tests.
.EXAMPLE
Create-TestProject -filename "pruebacontemplate" -Path "c:\zz\x"
.EXAMPLE
Create-TestProject -filename "pruebacontemplate" -Path "c:\zz\x" -OnlyTestFile
#>
function Create-TestProject
{
[CmdletBinding()]
Param
(
# Descripción de ayuda de Parám1
[Parameter(Mandatory=$true,
Position=0)]
[String]
$filename,
[Parameter(Mandatory=$true,
Position=1)]
[String]
$Path,
[Parameter(Position=2)]
[switch]
$OnlyTestFile
)
try
{
if ($OnlyTestFile -eq $false){
Get-Content "$scriptDirectory\SkeletonF.TXT" | Out-File "$path\$filename.ps1" -Encoding ascii
}
$skt_content=Get-Content "$scriptDirectory\Skeleton.TXT"
$skt_contentT=($skt_content -replace "var_internalscripname", $filename)
$skt_contentT | Out-File "$path\$filename.Tests.ps1" -Encoding ascii
}
catch
{
throw
}
}