Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@
It "Throw an Exception when set testtorun to 'returnduplicateparameter'" {
try
{
Get-Command testgetcommand-dynamicparametersdcr -testtorun returnduplicateparameter -ErrorAction SilentlyContinue
Get-Command testgetcommand-dynamicparametersdcr -testtorun returnduplicateparameter -ErrorAction Stop
throw "No Exception!"
}
catch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,15 @@ Describe "Set-Timezone test cases" -Tags @('Feature', 'RequireAdminOnWindows') {
}

It "Call Set-TimeZone with invalid Id" {
$exception = $null
try { Set-TimeZone -Id "zzInvalidID" } catch { $exception = $_ }
$exception.FullyQualifiedErrorID | Should Be "TimeZoneNotFound,Microsoft.PowerShell.Commands.SetTimeZoneCommand"
try
{
Set-TimeZone -Id "zzInvalidID"
throw "No Exception!"
}
catch
{
$_.FullyQualifiedErrorID | Should Be "TimeZoneNotFound,Microsoft.PowerShell.Commands.SetTimeZoneCommand"
}
}

It "Call Set-TimeZone by Name" {
Expand All @@ -178,9 +184,15 @@ Describe "Set-Timezone test cases" -Tags @('Feature', 'RequireAdminOnWindows') {
}

It "Call Set-TimeZone with invalid Name" {
$exception = $null
try { Set-TimeZone -Name "zzINVALID_Name" } catch { $exception = $_ }
$exception.FullyQualifiedErrorID | Should Be "TimeZoneNotFound,Microsoft.PowerShell.Commands.SetTimeZoneCommand"
try
{
Set-TimeZone -Name "zzINVALID_Name"
throw "No Exception!"
}
catch
{
$_.FullyQualifiedErrorID | Should Be "TimeZoneNotFound,Microsoft.PowerShell.Commands.SetTimeZoneCommand"
}
}

It "Verify that alias 'stz' exists" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,7 @@ ZoneId=$FileType
)
try {
Set-ExecutionPolicy -Scope $policyScope -ExecutionPolicy Restricted
throw "No Exception!"
}
catch {
$_.FullyQualifiedErrorId | Should Be "CantSetGroupPolicy,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Describe "SecureString conversion tests" -Tags "CI" {
It "using null arguments to ConvertFrom-SecureString produces an exception" {
try {
ConvertFrom-SecureString -secureString $null -key $null
throw "No Exception!"
}
catch {
$_.FullyQualifiedErrorId | should be "ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ConvertFromSecureStringCommand"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Describe "Export-Alias DRT Unit Tests" -Tags "CI" {

try{
Export-Alias $fulltestpath abcd02
throw "No Exception!"
}
catch{
$_.FullyQualifiedErrorId | Should be "FileOpenFailure,Microsoft.PowerShell.Commands.ExportAliasCommand"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Describe "Format-Wide" -Tags "CI" {
try
{
Format-Wide -InputObject $(Get-ChildItem) -Property CreationTime -View aoeu
throw "No Exception!"
}
catch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
try
{
test-PositionalBinding1 1
throw "No Exception!"
}
catch
{
Expand Down Expand Up @@ -64,6 +65,7 @@
try
{
test-allownullattributes -Parameter2 1 -Parameter3 $null -ShowMe 1
throw "No Exception!"
}
catch
{
Expand All @@ -89,6 +91,7 @@
try
{
test-namedwithboolishargument -Parameter2 -Parameter1
throw "No Exception!"
}
catch
{
Expand Down Expand Up @@ -148,6 +151,7 @@
try
{
test-singleintparameter -Parameter1 'dookie'
throw "No Exception!"
}
catch
{
Expand Down Expand Up @@ -266,6 +270,7 @@
try
{
test-nameconflicts6 -Parameter2 1
throw "No Exception!"
}
catch
{
Expand Down