Skip to content

Commit 8785de7

Browse files
committed
Another add to the Set tests
1 parent ce84cfa commit 8785de7

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Tests/xComputermanagement.Tests.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,14 @@ InModuleScope MSFT_xComputer {
139139
Assert-MockCalled -CommandName Add-Computer -Exactly 1 -Scope It -ParameterFilter {$DomainName -and $NewName}
140140
Assert-MockCalled -CommandName Add-Computer -Exactly 0 -Scope It -ParameterFilter {$WorkGroupName}
141141
}
142+
It 'Changes ComputerName and changes Workgroup to Domain with specified OU' {
143+
Mock Get-WMIObject {[PSCustomObject]@{Domain = 'Contoso';Workgroup='Contoso';PartOfDomain=$false}}
144+
Mock GetComputerDomain {''}
145+
Set-TargetResource -Name $NotComputerName -DomainName 'Contoso.com' -JoinOU 'OU=Computers,DC=contoso,DC=com' -Credential $Credential | Should BeNullOrEmpty
146+
Assert-MockCalled -CommandName Rename-Computer -Exactly 0 -Scope It
147+
Assert-MockCalled -CommandName Add-Computer -Exactly 1 -Scope It -ParameterFilter {$DomainName -and $NewName}
148+
Assert-MockCalled -CommandName Add-Computer -Exactly 0 -Scope It -ParameterFilter {$WorkGroupName}
149+
}
142150
It 'Changes ComputerName and changes Workgroup to new Workgroup' {
143151
Mock Get-WMIObject {[PSCustomObject]@{Domain = 'Contoso';Workgroup='Contoso';PartOfDomain=$false}}
144152
Mock GetComputerDomain {''}

0 commit comments

Comments
 (0)