Powershell Bob Help

I’ve tried testing, and it’s stating this under every test:

Message: This test should run but it did not. Most likely a setup in some parent block failed.

Stack-trace:

Here is my code:

Function Get-BobResponse ([string]$HeyBob) {
        $HeyBob = $HeyBob.Trim()
        
        If ($HeyBob.ToUpper() -ceq $HeyBob) -and ($HeyBob -cmatch "[A-Za-z]") {
            $Shouting = $True
        } ElseIf ($HeyBob[$HeyBob.Length - 1] -eq "?") {
            $Question = $true
        } ElseIf ([string]::IsNullOrEmpty($HeyBob)) {
            $SaidNothing = $True
        } ElseIf ($SaidNothing) {
            Return "Fine. Be that way"
        } ElseIf ($Question -and $Shouting) {
            Return "Calm down, I know what I'm doing!"
        } Elseif ($Question) {
            Return "Sure."
        } ElseIf ($Shouting) {
            Return "Whoa, chill out!"
        } Else {
        Return "Whatever."
        }
}

Any help is much appreciated. Thanks!

1 Like

Let’s say there is a case when the first 3 if-else statements are not triggered and the code is now checking for ElseIf ($SaidNothing), what exactly is the value of $SaidNothing here?
Same question for later statements