Invoke-Item tests added

This commit is contained in:
Alex Jordan committed 2016-06-29 10:52:56 -07:00
1 parent eec3b334cc
commit 61a6713f4c
1 file changed
+46
+46
View File
@@ -0,0 +1,46 @@
function Clean-State
{
if (Test-Path $FullyQualifiedLink)
{
Remove-Item $FullyQualifiedLink -Force
}
if (Test-Path $FullyQualifiedFile)
{
Remove-Item $FullyQualifiedFile -Force
}
if (Test-Path $FullyQualifiedFolder)
{
Remove-Item $FullyQualifiedFolder -Force
}
}
Describe "New-Item" {
$tmpDirectory = $TestDrive
$testfile = "testfile.txt"
$testfolder = "newDirectory"
$testlink = "testlink"
$FullyQualifiedFile = Join-Path -Path $tmpDirectory -ChildPath $testfile
$FullyQualifiedFolder = Join-Path -Path $tmpDirectory -ChildPath $testfolder
$FullyQualifiedLink = Join-Path -Path $tmpDirectory -ChildPath $testlink
BeforeEach {
Clean-State
}
It "Should call the function without error" {
{
New-Item -Name $testfile -Path $tmpDirectory -ItemType file } | Should Not Throw
}
It "Should invoke a text file without error" {
New-Item -Name $testfile -Path $tmpDirectory -ItemType file
Test-Path $FullyQualifiedFile | Should Be $true
$fileInfo = Get-ChildItem $FullyQualifiedFile
$fileInfo.Target | Should Be $null
$fileInfo.LinkType | Should Be $null
Invoke-Item $FullyQualifiedFile | Should Not throw
}
}