@@ -1707,17 +1707,17 @@ Describe 'DSC_Computer\Get-ComputerDomain' -Tag 'Private' {
17071707 }
17081708 }
17091709
1710- Mock - CommandName Get-Item - ParameterFilter { $Path -eq ' Env:\USERDOMAIN ' } - MockWith {
1710+ Mock - CommandName Get-CimInstance - ParameterFilter { $ClassName -eq ' Win32_NTDomain ' } - MockWith {
17111711 [PSCustomObject ] @ {
1712- Value = ' CONTOSO'
1712+ DomainName = ' CONTOSO'
17131713 }
17141714 }
17151715 }
17161716
17171717 BeforeDiscovery {
17181718 $testCases = @ (
1719- @ { value = $true ; result = ' CONTOSO' ; GetItemCount = 1 }
1720- @ { value = $false ; result = ' contoso.com' ; GetItemCount = 0 }
1719+ @ { value = $true ; result = ' CONTOSO' ; GetCimInstanceCount = 2 }
1720+ @ { value = $false ; result = ' contoso.com' ; GetCimInstanceCount = 1 }
17211721 )
17221722 }
17231723
@@ -1733,8 +1733,7 @@ Describe 'DSC_Computer\Get-ComputerDomain' -Tag 'Private' {
17331733 Get-ComputerDomain @getComputerDomainParameters | Should - Be $result
17341734 }
17351735
1736- Should - Invoke - CommandName Get-CimInstance - Exactly - Times 1 - Scope It
1737- Should - Invoke - CommandName Get-Item - Exactly - Times $GetItemCount - Scope It
1736+ Should - Invoke - CommandName Get-CimInstance - Exactly - Times $GetCimInstanceCount - Scope It
17381737 }
17391738 }
17401739
@@ -1747,9 +1746,9 @@ Describe 'DSC_Computer\Get-ComputerDomain' -Tag 'Private' {
17471746 }
17481747 }
17491748
1750- Mock - CommandName Get-Item - ParameterFilter { $Path -eq ' Env:\USERDOMAIN ' } - MockWith {
1749+ Mock - CommandName Get-CimInstance - ParameterFilter { $ClassName -eq ' Win32_NTDomain ' } - MockWith {
17511750 [PSCustomObject ] @ {
1752- Value = ' CONTOSO'
1751+ DomainName = ' CONTOSO'
17531752 }
17541753 }
17551754 }
@@ -1761,7 +1760,6 @@ Describe 'DSC_Computer\Get-ComputerDomain' -Tag 'Private' {
17611760 }
17621761
17631762 Should - Invoke - CommandName Get-CimInstance - Exactly - Times 1 - Scope It
1764- Should - Invoke - CommandName Get-Item - Exactly - Times 0 - Scope It
17651763 }
17661764 }
17671765
@@ -1782,9 +1780,9 @@ Describe 'DSC_Computer\Get-ComputerDomain' -Tag 'Private' {
17821780 }
17831781 }
17841782
1785- Mock - CommandName Get-Item - ParameterFilter { $Path -eq ' Env:\USERDOMAIN ' } - MockWith {
1783+ Mock - CommandName Get-CimInstance - ParameterFilter { $ClassName -eq ' Win32_NTDomain ' } - MockWith {
17861784 [PSCustomObject ] @ {
1787- Value = ' Computer1 '
1785+ DomainName = $null
17881786 }
17891787 }
17901788 }
@@ -1801,7 +1799,6 @@ Describe 'DSC_Computer\Get-ComputerDomain' -Tag 'Private' {
18011799 }
18021800
18031801 Should - Invoke - CommandName Get-CimInstance - Exactly - Times 1 - Scope It
1804- Should - Invoke - CommandName Get-Item - Exactly - Times 0 - Scope It
18051802 }
18061803 }
18071804 }
0 commit comments