Increase code coverage #22

Merged
OCram85 merged 34 commits from dev into master 2018-03-21 12:16:09 +01:00
2 changed files with 35 additions and 1 deletions
Showing only changes of commit 5910c44356 - Show all commits

View File

@ -0,0 +1,34 @@
#region HEADER
$RepoRoot = (Get-GitDirectory).replace('\.git', '')
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
$sut = $sut -replace "\d{2}`_", ''
$suthome = (Get-ChildItem -Path $RepoRoot -Exclude ".\tests\" -Filter $sut -Recurse).FullName
# Skip try loading the source file if it doesn't exists.
If ($suthome.Length -gt 0) {
. $suthome
}
Else {
Write-Warning ("Could not find source file {0}" -f $sut)
}
# load additional functions defined in the repository. Replace the expression <FunctionName>.
. (Get-ChildItem -Path $RepoRoot -Filter "Get-RandomKey.ps1" -Recurse).FullName
#endregion HEADER
Describe "Set-ChallengeFile" {
Context "Tests with custom path" {
It "Working dir and path not exist" {
Set-ChallengeFile -Path 'C:\CredentialStore\Challenge.bin' | Should -Not -Throw
}
It "No parameter and non file should return true" {
if (Test-Path -Path ("{0}\PSCredentialStore\Challenge.bin" -f $env:ProgramData)) {
Remove-Item -Path ("{0}\PSCredentialStore\Challenge.bin" -f $env:ProgramData)
}
Set-ChallengeFile | Should -Be $true
}
It "Existing Credential file should return error" {
{ Set-ChallengeFile } | Should -Throw
}
}
}

View File

@ -12,7 +12,7 @@ Else {
}
# load additional functions defined in the repository. Replace the expression <FunctionName>.
. (Get-ChildItem -Path $RepoRoot -Filter "Test-ChallengeFile.ps1" -Recurse).FullName
#. (Get-ChildItem -Path $RepoRoot -Filter "Test-ChallengeFile.ps1" -Recurse).FullName
#endregion HEADER