I'm stuck on the first exercise inwhich I'm support to generate responses from Bob, but I get 25 errors and I'm not sure as to what they mean as I've tested everything in ISE and it works as expected. Can someone that's passed this test give him a hint as to where I'm going wrong?
Function Get-BobResponse {
[CmdletBinding()]
Param(
[string]$HeyBob = $(read-host "Say something to Bob")
)
#.SYNOPSIS
#Bob is a lackadaisical teenager. In conversation, his responses are very limited.
#.DESCRIPTION
#Bob is a lackadaisical teenager. In conversation, his responses are very limited.
#Bob answers 'Sure.' if you ask him a question.
#He says 'Fine. Be that way!' if you address him without actually saying anything.
if([string]::IsNullOrWhiteSpace($HeyBob)){
write-host "Fine. Be that way!"
}
#He answers 'Calm down, I know what I'm doing!' if you yell a question at him.
elseif($HeyBob -eq $HeyBob.ToUpper() -and $HeyBob.EndsWith("?") -and $HeyBob -match "[A-Z]"){
write-host "Calm down, I know what I'm doing!"
}
elseif ($HeyBob.EndsWith("?")){
write-host "Sure"
}
#He answers 'Whoa, chill out!' if you yell at him.
elseif ($HeyBob -ceq $HeyBob.ToUpper() -and $HeyBob -match "[A-Z]"){
write-host "Whoa, chill out!"
}
#He answers 'Whatever.' to anything else.
else{
write-host "Whatever"
}
}
Get-BobResponse
I don't understand the errors presented such as the first one:
Test Failure
Message: Expected exactly 'Whatever.', but got $null.
Stack-trace: at Get-BobResponse -HeyBob "Tom-ay-to, tom-aaaah-to." | Should -BeExactly "Whatever.", /mnt/exercism-iteration/BobResponse.tests.ps1:8
at <ScriptBlock>, /mnt/exercism-iteration/BobResponse.tests.ps1:8