Increase code coverage #22

Merged
OCram85 merged 34 commits from dev into master 2018-03-21 12:16:09 +01:00
Showing only changes of commit 1d00981454 - Show all commits

View File

@ -42,7 +42,7 @@ Describe "Set-ChallengeFile" {
} }
It "Test directory creation for shared store" { It "Test directory creation for shared store" {
if (Test-Path -Path ("{0}\PSCredentialStore" -f $env:ProgramData)) { if (Test-Path -Path ("{0}\PSCredentialStore" -f $env:ProgramData)) {
Remove-Item -Path ("{0}\PSCredentialStore" -f $env:ProgramData) Remove-Item -Path ("{0}\PSCredentialStore" -f $env:ProgramData) -Force -Recurse
} }
Set-ChallengeFile Set-ChallengeFile
Test-Path -Path ("{0}\PSCredentialStore" -f $env:ProgramData) | Should -Be $true Test-Path -Path ("{0}\PSCredentialStore" -f $env:ProgramData) | Should -Be $true
@ -52,7 +52,7 @@ Describe "Set-ChallengeFile" {
Mock New-Item {throw "foobar exception"} Mock New-Item {throw "foobar exception"}
It "Test exception handling if the root directory could not be created" { It "Test exception handling if the root directory could not be created" {
if (Test-Path -Path ("{0}\PSCredentialStore" -f $env:ProgramData)) { if (Test-Path -Path ("{0}\PSCredentialStore" -f $env:ProgramData)) {
Remove-Item -Path ("{0}\PSCredentialStore" -f $env:ProgramData) Remove-Item -Path ("{0}\PSCredentialStore" -f $env:ProgramData) -Force -Recurse
} }
{ Set-ChallengeFile } | Should -Throw "Could not create the parent data dir*" { Set-ChallengeFile } | Should -Throw "Could not create the parent data dir*"
} }