Skip to content

Commit

Permalink
Fix for Stephanevg#122
Browse files Browse the repository at this point in the history
Methods with undefined return types should be treated like void methods
  • Loading branch information
vikingtiger committed Oct 20, 2019
1 parent a097c49 commit c20fbf1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Code/Functions/Public/Write-CUPesterTest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ Function Write-CUPesterTest {

[void]$sb.AppendLine($visibility)

If ($Method.ReturnType -eq '[void]' -or $Null -eq $Method.ReturnType) {
If (!($Method.ReturnType) -or $Method.ReturnType -eq '[void]') {
[void]$sb.AppendLine("It '[$($Class.Name)] --> $($Method.Name)$($Signature) Should not return anything (voided)' {")
}
else {
Expand Down Expand Up @@ -422,12 +422,12 @@ Function Write-CUPesterTest {

[void]$sb.AppendLine("# -- Assert")
[void]$sb.AppendLine("")
If ($Method.ReturnType -eq '[void]' -or $Null -eq $Method.ReturnType) {
[void]$sb.AppendLine("$MethodCall" + '| should be $null')
If (!($Method.ReturnType) -or $Method.ReturnType -eq '[void]') {
[void]$sb.AppendLine("$MethodCall" + '| Should -Be $null')
}
else {

[void]$sb.AppendLine("($MethodCall).GetType().Name | should be $ReturnType")
[void]$sb.AppendLine("($MethodCall).GetType().Name | Should -Be $ReturnType")
}


Expand Down

0 comments on commit c20fbf1

Please sign in to comment.