Skip to content

Commit

Permalink
Updated conversion tests after returning $null values
Browse files Browse the repository at this point in the history
  • Loading branch information
nyanhp committed Jun 16, 2018
1 parent 4fa2ca9 commit b7b08de
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions Tests/Unit/MSFT_xADCommon.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,23 @@ try
}

It 'Throws an exception when an invalid forest mode is selected' {
{ConvertTo-DeploymentForestMode -Mode Nonexistant } | Should Throw
{ ConvertTo-DeploymentForestMode -Mode Nonexistant } | Should Throw
}

It 'Throws an exception when an invalid mode id is selected' {
{ConvertTo-DeploymentForestMode -ModeId 666 } | Should Throw
It 'Throws no exception when a null value is passed' {
{ ConvertTo-DeploymentForestMode -Mode $null } | Should Not Throw
}

It 'Throws no exception when an invalid mode id is selected' {
{ ConvertTo-DeploymentForestMode -ModeId 666 } | Should Not Throw
}

It 'Returns $null when a null value is passed' {
ConvertTo-DeploymentForestMode -Mode $null | Should Be $null
}

It 'Returns $null when an invalid mode id is selected' {
ConvertTo-DeploymentForestMode -ModeId 666 | Should Be $null
}
}
#endregion
Expand All @@ -580,12 +592,24 @@ try
ConvertTo-DeploymentDomainMode -ModeId 5 | Should Be ([Microsoft.DirectoryServices.Deployment.Types.DomainMode]::Win2012)
}

It 'Throws an exception when an invalid forest mode is selected' {
{ConvertTo-DeploymentDomainMode -Mode Nonexistant } | Should Throw
It 'Throws an exception when an invalid domain mode is selected' {
{ ConvertTo-DeploymentDomainMode -Mode Nonexistant } | Should Throw
}

It 'Throws no exception when a null value is passed' {
{ ConvertTo-DeploymentDomainMode -Mode $null } | Should Not Throw
}

It 'Throws no exception when an invalid mode id is selected' {
{ ConvertTo-DeploymentDomainMode -ModeId 666 } | Should Not Throw
}

It 'Returns $null when a null value is passed' {
ConvertTo-DeploymentDomainMode -Mode $null | Should Be $null
}

It 'Throws an exception when an invalid mode id is selected' {
{ConvertTo-DeploymentDomainMode -ModeId 666 } | Should Throw
It 'Returns $null when an invalid mode id is selected' {
ConvertTo-DeploymentDomainMode -ModeId 666 | Should Be $null
}
}
#endregion
Expand Down

0 comments on commit b7b08de

Please sign in to comment.