Created
June 7, 2017 06:39
-
-
Save mallibone/238de850533145e10c2fde4e1473e086 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$here = Split-Path -Parent $MyInvocation.MyCommand.Path | |
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.' | |
. "$here\$sut" | |
$mockReply = @("Monday.txt", "Tuesday.txt", "Wednesday.txt") | |
Describe "HasEntryInDirectory" { | |
Context "If the filename exists in the directory" { | |
Mock Get-ChildItem {return $mockReply} | |
$result = HasEntryInDirectory "Monday.txt" "C:\LogEntries\2017\23\" | |
It "Returns true" { | |
$result | Should Be $true | |
} | |
} | |
Context "If the filename does not exists in the directory" { | |
Mock Get-ChildItem {return @("Monday.txt", "Tuesday.txt", "Wednesday.txt")} | |
$result = HasEntryInDirectory "Thursday.txt" "C:\LogEntries\2017\23\" | |
It "Returns false" { | |
$result | Should Be $false | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment