Skip to content

Commit f484a4d

Browse files
committed
Fixed bugs in tests
$True was set as expected value when it should have been false. Setup Mock Get-WMIObject to allow test to work correctly.
1 parent b6a1ee0 commit f484a4d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Tests/Unit/MSFT_xComputer.Tests.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ try
128128
}
129129
It 'Should return false if description is same as specified' {
130130
Mock Get-CimInstance {[PSCustomObject]@{Description = 'This is not my computer'}}
131-
Test-TargetResource -Name $env:COMPUTERNAME -Description "This is my computer" | Should Be $true
132-
Test-TargetResource -Name 'localhost' -Description "This is my computer" | Should Be $true
131+
Test-TargetResource -Name $env:COMPUTERNAME -Description "This is my computer" | Should Be $false
132+
Test-TargetResource -Name 'localhost' -Description "This is my computer" | Should Be $false
133133
}
134134
}
135135
Context "$($Global:DSCResourceName)\Get-TargetResource" {
@@ -284,7 +284,7 @@ try
284284
{Set-TargetResource -Name "ThisIsBad<>"} | Should Throw
285285
}
286286
It 'Changes computer description'{
287-
#Mock Get-CimInstance {[PSCustomObject]@{Description = 'This is not my computer'}}
287+
Mock Get-WMIObject {[PSCustomObject]@{Domain = 'Contoso';Workgroup='Contoso';PartOfDomain=$false}}
288288
Set-TargetResource -Name $env:COMPUTERNAME -Description = 'This is my computer'
289289
Assert-MockCalled -CommandName Set-CimInstance -Exactly 1 -Scope It
290290
}

0 commit comments

Comments
 (0)