Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
6beafc0
commit
kalgiz Mar 28, 2018
cb19b50
Merge branch 'master' of https://github.com/PowerShell/PowerShell
kalgiz Mar 29, 2018
3c0fa49
Merge branch 'master' of https://github.com/kalgiz/PowerShell
kalgiz Mar 30, 2018
4a8b4c5
Merge branch 'master' of https://github.com/PowerShell/PowerShell
kalgiz Apr 2, 2018
9d81797
Merge branch 'master' of https://github.com/kalgiz/PowerShell
kalgiz Apr 2, 2018
9dfa552
Merge branch 'master' of https://github.com/PowerShell/PowerShell
kalgiz Apr 3, 2018
4247332
Merge branch 'master' of https://github.com/PowerShell/PowerShell
kalgiz Apr 4, 2018
412ca3a
Merge branch 'master' of https://github.com/kalgiz/PowerShell
kalgiz Apr 4, 2018
5f3a58a
Merge branch 'master' of https://github.com/PowerShell/PowerShell
kalgiz Apr 5, 2018
40f98ff
Merge branch 'master' of https://github.com/PowerShell/PowerShell
kalgiz Apr 6, 2018
9aa27fb
Merge branch 'master' of https://github.com/PowerShell/PowerShell
kalgiz Apr 9, 2018
aede937
Merge branch 'master' of https://github.com/kalgiz/PowerShell
kalgiz Apr 9, 2018
103b5b6
Merge branch 'master' of https://github.com/PowerShell/PowerShell
kalgiz Apr 10, 2018
9423bf6
Merge branch 'master' of https://github.com/kalgiz/PowerShell
kalgiz Apr 10, 2018
b50d596
Merge branch 'master' of https://github.com/PowerShell/PowerShell
kalgiz Apr 11, 2018
3c0f928
Merge branch 'master' of https://github.com/PowerShell/PowerShell
kalgiz Apr 11, 2018
76e7d61
Merge branch 'master' of https://github.com/PowerShell/PowerShell
kalgiz Apr 11, 2018
051fd41
[Feature] CimCmdlets and Diagnostics module Error tests fix.
kalgiz Apr 17, 2018
c99c2f2
[Featur] ShouldBeErrorId => Should -Throw -ErrorId in Core module.
kalgiz Apr 17, 2018
e0607f1
[Feature] Should Be => Should -BeTrue in Host module.
kalgiz Apr 17, 2018
0defa73
[Feature] ShouldBeErrorId => Should -Throw -ErrorId in Security module.
kalgiz Apr 17, 2018
2a4a293
[Feature] ShouldBeErrorId => Should -Throw -ErrorId in Management mod…
kalgiz Apr 17, 2018
deef7f1
Merge branch 'master' of https://github.com/kalgiz/PowerShell
kalgiz Apr 17, 2018
d4bb026
[Feature] ShouldBeErrorId => Should -Throw -ErrorId in Utility module.
kalgiz Apr 18, 2018
d116ebc
[Feature] ShouldBeErrorId => Should -Throw -ErrorId in WSMan.Manageme…
kalgiz Apr 18, 2018
5cb96ac
[Feature] ShouldBeErrorId => Should -Throw -ErrorId in engine.
kalgiz Apr 18, 2018
58e7d14
[Feature] try {} catch {} => Should -Throw -ErrorId in engine.
kalgiz Apr 18, 2018
83413dd
[Feature] Tests fix
kalgiz Apr 18, 2018
dac1442
[Feature] try {} catch {} => Should -Throw -ErrorId in engine.
kalgiz Apr 18, 2018
c6affbe
[Feature] ShouldBeErrorId => Should -Throw -ErrorId in Host.
kalgiz Apr 18, 2018
9df619d
[Feature] try {} catch {} => Should -Throw -ErrorId in Host
kalgiz Apr 18, 2018
56524ca
[Feature] Use new Pester syntax -Parameter in Installer.
kalgiz Apr 18, 2018
8f905ee
[Feature] ShouldBeErrorId => Should -Throw -ErrorId in Language.
kalgiz Apr 18, 2018
0955b7a
[Feature] try {} catch {} => Should -Throw -ErrorId in Language.
kalgiz Apr 19, 2018
f58b56e
[Feature] try {} catch {} => Should -Throw -ErrorId in Management.
kalgiz Apr 19, 2018
78189ba
[Feature] try {} catch {} => Should -Throw -ErrorId in Security module.
kalgiz Apr 19, 2018
b535c2f
Merge branch 'master' of https://github.com/kalgiz/PowerShell
kalgiz Apr 19, 2018
a60304c
[Feature] ConstrainedLanguageRestriction tests fixes.
kalgiz Apr 19, 2018
af33b1e
[Feature] try {} catch {} => Should -Throw -ErrorId in Security modul…
kalgiz Apr 19, 2018
6069527
[Feature] try {} catch {} => Should -Throw -ErrorId in Utility module.
kalgiz Apr 19, 2018
59b7351
[Feature] Tests fixes.
kalgiz Apr 19, 2018
33253a3
Merge branch 'master' of https://github.com/kalgiz/PowerShell into sh…
kalgiz Apr 19, 2018
3a1007f
[Feature] Tests fixes.
kalgiz Apr 20, 2018
75a4c4a
[Feature] Unblock-File tests fix.
kalgiz Apr 20, 2018
89d29e4
[Feature] CimCmdlets and Diagnostics module Error tests fix.
kalgiz Apr 17, 2018
46d83f1
[Featur] ShouldBeErrorId => Should -Throw -ErrorId in Core module.
kalgiz Apr 17, 2018
ca2ab95
[Feature] Should Be => Should -BeTrue in Host module.
kalgiz Apr 17, 2018
f6d878f
[Feature] ShouldBeErrorId => Should -Throw -ErrorId in Security module.
kalgiz Apr 17, 2018
e05e4c7
[Feature] ShouldBeErrorId => Should -Throw -ErrorId in Management mod…
kalgiz Apr 17, 2018
cde70dd
[Feature] ShouldBeErrorId => Should -Throw -ErrorId in Utility module.
kalgiz Apr 18, 2018
def148f
[Feature] ShouldBeErrorId => Should -Throw -ErrorId in WSMan.Manageme…
kalgiz Apr 18, 2018
8b11e42
[Feature] ShouldBeErrorId => Should -Throw -ErrorId in engine.
kalgiz Apr 18, 2018
17cd7ce
[Feature] try {} catch {} => Should -Throw -ErrorId in engine.
kalgiz Apr 18, 2018
f5c1487
[Feature] Tests fix
kalgiz Apr 18, 2018
0ffb1ed
[Feature] try {} catch {} => Should -Throw -ErrorId in engine.
kalgiz Apr 18, 2018
472a4af
[Feature] ShouldBeErrorId => Should -Throw -ErrorId in Host.
kalgiz Apr 18, 2018
6b77738
[Feature] try {} catch {} => Should -Throw -ErrorId in Host
kalgiz Apr 18, 2018
ee282d6
[Feature] Use new Pester syntax -Parameter in Installer.
kalgiz Apr 18, 2018
ea6c7f6
[Feature] ShouldBeErrorId => Should -Throw -ErrorId in Language.
kalgiz Apr 18, 2018
c8c846e
[Feature] try {} catch {} => Should -Throw -ErrorId in Language.
kalgiz Apr 19, 2018
e3383f0
[Feature] try {} catch {} => Should -Throw -ErrorId in Management.
kalgiz Apr 19, 2018
2220ea3
[Feature] try {} catch {} => Should -Throw -ErrorId in Security module.
kalgiz Apr 19, 2018
fe00e85
[Feature] ConstrainedLanguageRestriction tests fixes.
kalgiz Apr 19, 2018
ad427f0
[Feature] try {} catch {} => Should -Throw -ErrorId in Security modul…
kalgiz Apr 19, 2018
70b2bfa
[Feature] try {} catch {} => Should -Throw -ErrorId in Utility module.
kalgiz Apr 19, 2018
7202c93
[Feature] Tests fixes.
kalgiz Apr 19, 2018
8886ea8
[Feature] Tests fixes.
kalgiz Apr 20, 2018
e95bf34
[Feature] -ea => -ErrorAction
kalgiz Apr 23, 2018
bc0ddc1
[Feature] Unblock-File tests fixes.
kalgiz Apr 24, 2018
cc091f8
Merge branch 'master' of https://github.com/kalgiz/PowerShell
kalgiz Apr 24, 2018
5d240f3
Merge branch 'master' of https://github.com/PowerShell/PowerShell
kalgiz Apr 24, 2018
8ade48a
Merge branch 'master' of https://github.com/PowerShell/PowerShell
kalgiz Apr 25, 2018
14d9460
Merge branch 'master' of https://github.com/kalgiz/PowerShell into sh…
kalgiz Apr 25, 2018
a2f6493
[Feature] Tests fix
kalgiz Apr 25, 2018
b588fba
[Feautre] Test fix.
kalgiz Apr 25, 2018
e6bdde9
[Feature] Test in ConsoleHost.Tests.ps1 clean up.
kalgiz Apr 25, 2018
fc53623
[Feature] Test fix
kalgiz Apr 25, 2018
492ea19
[Feature]
kalgiz Apr 26, 2018
262a572
[Feature] -ev => -ErrorVariable
kalgiz Apr 26, 2018
2441c49
[Feature] -r => -Recurse
kalgiz Apr 26, 2018
ce2a29f
Merge branch 'master' of https://github.com/PowerShell/PowerShell
kalgiz Apr 27, 2018
41093fb
Fix tests for Requires.Tests.ps1
kalgiz May 4, 2018
cd49105
Merge branch 'master' of https://github.com/PowerShell/PowerShell
kalgiz May 4, 2018
500c853
Merge branch 'master' of https://github.com/kalgiz/PowerShell into sh…
kalgiz May 4, 2018
67b1dc3
Merge branch 'master' of https://github.com/PowerShell/PowerShell
kalgiz May 14, 2018
4640fb4
Merge branch 'master' of https://github.com/kalgiz/PowerShell into sh…
kalgiz May 15, 2018
5f8573c
Merge branch 'shouldBeErrorId-Throw-replace' of https://github.com/ka…
kalgiz May 15, 2018
bb7f6fa
[Feature] Tests fixes.
kalgiz May 15, 2018
9c0109e
Merge branch 'master' of https://github.com/PowerShell/PowerShell
kalgiz May 16, 2018
cf31ac0
Merge branch 'master' of https://github.com/kalgiz/PowerShell into sh…
kalgiz May 16, 2018
b5c0751
[Feature]
kalgiz May 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 10 additions & 41 deletions test/powershell/Host/ConsoleHost.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -93,35 +93,20 @@ Describe "ConsoleHost unit tests" -tags "Feature" {

Context "ShellInterop" {
It "Verify Parsing Error Output Format Single Shell should throw exception" {
try
{
& $powershell -outp blah -comm { $input }
Throw "Test execution should not reach here!"
}
catch
{
$_.FullyQualifiedErrorId | Should -Be "IncorrectValueForFormatParameter"
}
{ & $powershell -outp blah -comm { $input } } | Should -Throw -ErrorId "IncorrectValueForFormatParameter"
}

It "Verify Validate Dollar Error Populated should throw exception" {
$origEA = $ErrorActionPreference
$ErrorActionPreference = "Stop"
try
{
$a = 1,2,3
$a = 1,2,3
$e = {
$a | & $powershell -noprofile -command { wgwg-wrwrhqwrhrh35h3h3}
Throw "Test execution should not reach here!"
}
catch
{
$_.ToString() | Should -Match "wgwg-wrwrhqwrhrh35h3h3"
$_.FullyQualifiedErrorId | Should -Be "CommandNotFoundException"
}
finally
{
$ErrorActionPreference = $origEA
}
} | Should -Throw -ErrorId "CommandNotFoundException" -PassThru

$e.ToString() | Should -Match "wgwg-wrwrhqwrhrh35h3h3"

$ErrorActionPreference = $origEA
}

It "Verify Validate Output Format As Text Explicitly Child Single Shell does not throw" {
Expand All @@ -131,15 +116,7 @@ Describe "ConsoleHost unit tests" -tags "Feature" {
}

It "Verify Parsing Error Input Format Single Shell should throw exception" {
try
{
& $powershell -input blah -comm { $input }
Throw "Test execution should not reach here!"
}
catch
{
$_.FullyQualifiedErrorId | Should -Be "IncorrectValueForFormatParameter"
}
{ & $powershell -input blah -comm { $input } } | Should -Throw -ErrorId "IncorrectValueForFormatParameter"
}
}
Context "CommandLine" {
Expand Down Expand Up @@ -496,15 +473,7 @@ foo
recurse $args
}

try
{
recurse "args"
Throw "Incorrect exception"
}
catch
{
$_.FullyQualifiedErrorId | Should -Be "CallDepthOverflow"
}
{ recurse "args" } | Should -Throw -ErrorId "CallDepthOverflow"
}
}

Expand Down
24 changes: 4 additions & 20 deletions test/powershell/Host/HostUtilities.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,13 @@ Describe "InvokeOnRunspace method argument error handling" -tags "Feature" {
}

It "Null argument exception should be thrown for null PSCommand argument" {

try
{
[System.Management.Automation.HostUtilities]::InvokeOnRunspace($null, $localRunspace)
throw "InvokeOnRunspace method did not throw expected PSArgumentNullException exception"
}
catch
{
$_.FullyQualifiedErrorId | Should -Be "PSArgumentNullException"
}
{ [System.Management.Automation.HostUtilities]::InvokeOnRunspace($null, $localRunspace) } |
Should -Throw -ErrorId "PSArgumentNullException"
}

It "Null argument exception should be thrown for null Runspace argument" {

try
{
[System.Management.Automation.HostUtilities]::InvokeOnRunspace($command, $null)
throw "InvokeOnRunspace method did not throw expected PSArgumentNullException exception"
}
catch
{
$_.FullyQualifiedErrorId | Should -Be "PSArgumentNullException"
}
{ [System.Management.Automation.HostUtilities]::InvokeOnRunspace($command, $null) } |
Should -Throw -ErrorId "PSArgumentNullException"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ dir -Recurse `

It "Input '<inputStr>' should throw in tab completion" -TestCases $testCases {
param($inputStr, $expected)
$inputStr | ShouldBeErrorId $expected
$inputStr | Should -Throw -ErrorId $expected
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/powershell/Installer/WindowsInstaller.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ Describe "Windows Installer" -Tags "Scenario" {
}
}

$result | Should Not Be $null
$result | Should -Not -Be $null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ Describe 'ValidateSet support a dynamically generated set' -Tag "CI" {
}

It 'Throw if IValidateSetValuesGenerator is not implemented' {
{ Get-TestValidateSet0 -Param1 "TestString" -ErrorAction Stop } | ShouldBeErrorId "Argument"
{ Get-TestValidateSet0 -Param1 "TestString" -ErrorAction Stop } | Should -Throw -ErrorId "Argument"
}

It 'Dynamically generated set works in C# with default (immediate) cache expire' {
Expand All @@ -270,7 +270,7 @@ Describe 'ValidateSet support a dynamically generated set' -Tag "CI" {
It 'Empty dynamically generated set throws in C#' {
$exc = {
Get-TestValidateSet5 -Param1 "TestString1" -ErrorAction Stop
} | ShouldBeErrorId "ParameterArgumentValidationError,Test.Language.TestValidateSetCommand5"
} | Should -Throw -ErrorId "ParameterArgumentValidationError,Test.Language.TestValidateSetCommand5" -PassThru
$exc.Exception.InnerException.ErrorRecord.FullyQualifiedErrorId | Should -BeExactly "ValidateSetGeneratedValidValuesListIsNull"
}
}
Expand Down Expand Up @@ -356,20 +356,20 @@ Describe 'ValidateSet support a dynamically generated set' -Tag "CI" {
}

It 'Get the appropriate error message' {
{Get-TestValidateSetPS4 -Param1 "TestStringWrong" -ErrorAction Stop} | ShouldBeErrorId "ParameterArgumentValidationError,Get-TestValidateSetPS4"
{Get-TestValidateSetPS4 -Param1 "TestStringWrong" -ErrorAction Stop} | Should -Throw -ErrorId "ParameterArgumentValidationError,Get-TestValidateSetPS4"
}

It 'Empty dynamically generated set throws in PowerShell script' {
$exc = {
Get-TestValidateSetPS5 -Param1 "TestString1" -ErrorAction Stop
} | ShouldBeErrorId "ParameterArgumentValidationError,Get-TestValidateSetPS5"
} | Should -Throw -ErrorId "ParameterArgumentValidationError,Get-TestValidateSetPS5" -PassThru
$exc.Exception.InnerException.ErrorRecord.FullyQualifiedErrorId | Should -BeExactly "ValidateSetGeneratedValidValuesListIsNull"
}

It 'Unimplemented valid values generator type throws in PowerShell script' {
{
Get-TestValidateSetPS6 -Param1 "AnyTestString" -ErrorAction Stop
} | ShouldBeErrorId "TypeNotFound"
} | Should -Throw -ErrorId "TypeNotFound"
}

It 'IValidateSetValuesGenerator works in PowerShell module' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ function test-it([EE]$ee){$ee}
}
finally
{
Remove-Module -ea ignore MSFT_2081529
Remove-Module -ErrorAction ignore MSFT_2081529
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,43 +231,27 @@ Describe "Exception error position" -Tags "CI" {
static f1() { [MSFT_3090412]::bar = 42 }
static f2() { throw "an error in f2" }
static f3() { "".Substring(0, 10) }
static f4() { dir nosuchfile -ea Stop }
static f4() { dir nosuchfile -ErrorAction Stop }
}

It "Setting a property that doesn't exist" {
try {
[MSFT_3090412]::f1()
throw "f1 should have thrown"
} catch {
$_.InvocationInfo.Line | Should -Match ([regex]::Escape('[MSFT_3090412]::bar = 42'))
}
$e = { [MSFT_3090412]::f1() } | Should -Throw -PassThru -ErrorId 'PropertyAssignmentException'
$e.InvocationInfo.Line | Should -Match ([regex]::Escape('[MSFT_3090412]::bar = 42'))
}

It "Throwing an exception" {
try {
[MSFT_3090412]::f2()
throw "f2 should have thrown"
} catch {
$_.InvocationInfo.Line | Should -Match ([regex]::Escape('throw "an error in f2"'))
}
$e = { [MSFT_3090412]::f2() } | Should -Throw -PassThru -ErrorId 'an error in f2'
$e.InvocationInfo.Line | Should -Match ([regex]::Escape('throw "an error in f2"'))
}

It "Calling a .Net method that throws" {
try {
[MSFT_3090412]::f3()
throw "f3 should have thrown"
} catch {
$_.InvocationInfo.Line | Should -Match ([regex]::Escape('"".Substring(0, 10)'))
}
$e = { [MSFT_3090412]::f3() } | Should -Throw -PassThru -ErrorId 'ArgumentOutOfRangeException'
$e.InvocationInfo.Line | Should -Match ([regex]::Escape('"".Substring(0, 10)'))
}

It "Terminating error" {
try {
[MSFT_3090412]::f4()
throw "f4 should have thrown"
} catch {
$_.InvocationInfo.Line | Should -Match ([regex]::Escape('dir nosuchfile -ea Stop'))
}
$e = { [MSFT_3090412]::f4() } | Should -Throw -PassThru -ErrorId 'PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand'
$e.InvocationInfo.Line | Should -Match ([regex]::Escape('dir nosuchfile -ErrorAction Stop'))
}
}

Expand Down Expand Up @@ -295,56 +279,26 @@ Describe "Exception from initializer" -Tags "CI" {
}

It "instance member w/ ctor" {
try {
[MSFT_6397334a]::new()
throw "[MSFT_6397334a]::new() should have thrown"
}
catch
{
$e = $_
$e.FullyQualifiedErrorId | Should -BeExactly 'InvalidCastFromStringToInteger'
$e.InvocationInfo.Line | Should -Match 'a = "zz"'
}
$e = { [MSFT_6397334a]::new() } | Should -Throw -ErrorId 'InvalidCastFromStringToInteger' -PassThru
$e.InvocationInfo.Line | Should -Match 'a = "zz"'
}

It "instance member w/o ctor" {
try {
[MSFT_6397334b]::new()
throw "[MSFT_6397334b]::new() should have thrown"
}
catch
{
$e = $_
$e.FullyQualifiedErrorId | Should -BeExactly 'InvalidCastFromStringToInteger'
$e.InvocationInfo.Line | Should -Match 'a = "zz"'
}
$e = { [MSFT_6397334b]::new() } | Should -Throw -ErrorId 'InvalidCastFromStringToInteger' -PassThru
$e.InvocationInfo.Line | Should -Match 'a = "zz"'
}

It "static member w/ ctor" {
try {
$null = [MSFT_6397334c]::a
throw "No Exception!"
}
catch
{
$_.Exception | Should -BeOfType System.TypeInitializationException
$e = $_.Exception.InnerException.InnerException.ErrorRecord
$e.FullyQualifiedErrorId | Should -BeExactly 'InvalidCastFromStringToInteger'
$e.InvocationInfo.Line | Should -Match 'a = "zz"'
}
$e = { $null = [MSFT_6397334c]::a } | Should -Throw -PassThru
$e.Exception | Should -BeOfType 'System.TypeInitializationException'
$e.Exception.InnerException.ErrorRecord.FullyQualifiedErrorId | Should -BeExactly 'InvalidCastFromStringToInteger'
$e.Exception.InnerException.InnerException.ErrorRecord.InvocationInfo.Line | Should -Match 'a = "zz"'
}

It "static member w/o ctor" {
try {
$null = [MSFT_6397334d]::a
throw "No Exception!"
}
catch
{
$_.Exception | Should -BeOfType System.TypeInitializationException
$e = $_.Exception.InnerException.InnerException.ErrorRecord
$e.FullyQualifiedErrorId | Should -BeExactly 'InvalidCastFromStringToInteger'
$e.InvocationInfo.Line | Should -Match 'a = "zz"'
}
$e = { $null = [MSFT_6397334d]::a } | Should -Throw -PassThru
$e.Exception | Should -BeOfType System.TypeInitializationException
$e.Exception.InnerException.InnerException.ErrorRecord.FullyQualifiedErrorId | Should -BeExactly 'InvalidCastFromStringToInteger'
$e.Exception.InnerException.InnerException.ErrorRecord.InvocationInfo.Line | Should -Match 'a = "zz"'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Describe "ComparisonOperator" -tag "CI" {
@{operator = "-isnot"; type = "[foo]"; expectedError='TypeNotFound,Microsoft.PowerShell.Commands.InvokeExpressionCommand'}
) {
param($operator, $type, $expectedError)
{ Invoke-Expression "'Hello' $operator $type" } | ShouldBeErrorId $expectedError
{ Invoke-Expression "'Hello' $operator $type" } | Should -Throw -ErrorId $expectedError
}

It "Should succeed in comparing type: <lhs> <operator> <rhs>" -TestCases @(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ Describe "Split Operator" -Tags CI {
}

It "Binary split operator doesn't works with RegexMatch,SimpleMatch" {
{ "abc" -split "B", 0, 'RegexMatch,SimpleMatch' } | ShouldBeErrorId "InvalidSplitOptionCombination"
{ "abc" -split "B", 0, 'RegexMatch,SimpleMatch' } | Should -Throw -ErrorId "InvalidSplitOptionCombination"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,21 +172,15 @@ Describe "Assign readonly/constant variables" -Tags "CI" {

Describe "Attribute error position" -Tags "CI" {
It "Ambiguous overloads" {
try
{
$e = {
& {
param(
[ValidateNotNull(1,2,3,4)]
$param
)
}
throw "Should have thrown"
}
catch
{
$_.InvocationInfo.Line | Should -Match ValidateNotNull
$_.FullyQualifiedErrorId | Should -Be MethodCountCouldNotFindBest
}
} | Should -Throw -PassThru -ErrorId 'MethodCountCouldNotFindBest'
$e.InvocationInfo.Line | Should -Match ValidateNotNull
}
}

Expand Down
Loading