Sha256: 6bdcf664047248b7851e43d0bf09e3a94d7c14d1d1872ded4dd009a0eeb8d795
Contents?: true
Size: 1.14 KB
Versions: 35
Compression:
Stored size: 1.14 KB
Contents
$ExercisePath = Split-Path -Parent $MyInvocation.MyCommand.Path $ScriptFile = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") $CommandName = "Get-TwoFer" # Remove the function if its already found If (Get-Command $CommandName -ErrorAction SilentlyContinue){ Write-Verbose "Removing the existing $CommandName function as it exists" Remove-Item -Path "Function:\$CommandName" } # Load the script file If (Test-Path "$ExercisePath\$ScriptFile"){ Write-Output ("Loading: {0}" -f "$ExercisePath\$ScriptFile") . ("$ExercisePath\$ScriptFile") } Else { # Display an error and stop the tests Write-Error "The file $ScriptFile was not found. You need to create your answer in a file named $ScriptFile" -ErrorAction Stop } Describe "Get-TwoFer" { It "Given <Name> expects <Expected>" -TestCases @( @{ Name = $null; Expected = "One for you, one for me" }, @{ Name = ""; Expected = "One for you, one for me" }, @{ Name = "Alice"; Expected = "One for Alice, one for me" } ) { Param( $Name, $Expected ) Get-TwoFer -Name $Name | Should -Be $Expected } }
Version data entries
35 entries across 35 versions & 1 rubygems