Created
February 22, 2019 15:03
-
-
Save shaneis/cd3ed86cefc649fd2dbec0da512deb3f to your computer and use it in GitHub Desktop.
This file contains 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
describe 'testing our function with scriptroot' { | |
# Get our self contained script info. | |
. .\Get-FunctionInfo.ps1 | |
$fInfo = Get-FunctionInfo -Path .\Get-NameScriptBlock.ps1 | |
# Create something we can dot-source. | |
$Fake = "function $($fInfo.Name) { $($fInfo.Definition) }" | |
$FakeFunc = [scriptblock]::Create($Fake) | |
. $FakeFunc | |
Context 'Results' { | |
It 'should have the expected default result' { | |
Get-Name | Should -Be 'Hello, you. Script root is C:\Users\shane.oneill\Git\Blog' | |
} | |
It 'should have the expected result for passed in values' { | |
Get-Name -Name 'Shane' | Should -Be 'Hello, Shane. Script root is C:\Users\shane.oneill\Git\Blog' | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment