Skip to content

Commit 1ded622

Browse files
committed
Added Domain Description Test
1 parent 9080e52 commit 1ded622

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

Tests/Unit/MSFT_xComputer.Tests.ps1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,17 @@ try
283283
It 'Throws if name contains illigal characters' {
284284
{Set-TargetResource -Name "ThisIsBad<>"} | Should Throw
285285
}
286-
It 'Changes computer description'{
286+
It 'Changes computer description in a workgroup'{
287287
Mock Get-ComputerDomain {''}
288288
Mock Get-WMIObject {[PSCustomObject]@{Domain = 'Contoso';Workgroup='Contoso';PartOfDomain=$false}}
289-
Set-TargetResource -Name $env:COMPUTERNAME -WorkGroupName 'Contoso' -Description = 'This is my computer'
289+
Set-TargetResource -Name $env:COMPUTERNAME -WorkGroupName 'Contoso' -Description = 'This is my computer' | Should BeNullOrEmpty
290+
Assert-MockCalled -CommandName Set-CimInstance -Exactly 1 -Scope It
291+
}
292+
It 'Changes computer description in a domain'{
293+
Mock Get-WMIObject {[PSCustomObject]@{Domain = 'Contoso.com';Workgroup='Contoso.com';PartOfDomain=$true}}
294+
Mock Get-ComputerDomain {'contoso.com'}
295+
Set-TargetResource -Name $Env:ComputerName | Should BeNullOrEmpty
296+
Set-TargetResource -Name $env:COMPUTERNAME -DomainName 'Contoso.com' -Credential $Credential -UnjoinCredential $Credential -Description = 'This is my computer' | Should BeNullOrEmpty
290297
Assert-MockCalled -CommandName Set-CimInstance -Exactly 1 -Scope It
291298
}
292299
}

0 commit comments

Comments
 (0)