|
1 | | -$Global:DSCModuleName = 'xComputerManagement' |
2 | | -$Global:DSCResourceName = 'MSFT_xComputer' |
| 1 | +$script:DSCModuleName = 'xComputerManagement' |
| 2 | +$script:DSCResourceName = 'MSFT_xComputer' |
3 | 3 |
|
4 | 4 | # Unit Test Template Version: 1.2.0 |
5 | 5 | $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) |
|
22 | 22 | { |
23 | 23 | #region Pester Tests |
24 | 24 |
|
25 | | - InModuleScope $Global:DSCResourceName { |
| 25 | + InModuleScope $script:DSCResourceName { |
| 26 | + $script:DSCResourceName = 'MSFT_xComputer' |
26 | 27 |
|
27 | | - Describe $Global:DSCResourceName { |
| 28 | + Describe $script:DSCResourceName { |
28 | 29 | # A real password isn't needed here - use this next line to avoid triggering PSSA rule |
29 | 30 | $securePassword = New-Object -Type SecureString |
30 | 31 | $credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList 'USER', $securePassword |
|
37 | 38 | 'name' |
38 | 39 | } |
39 | 40 |
|
40 | | - Context "$($Global:DSCResourceName)\Test-TargetResource" { |
| 41 | + Context "$($script:DSCResourceName)\Test-TargetResource" { |
41 | 42 | Mock -CommandName Get-WMIObject -MockWith { |
42 | 43 | [PSCustomObject] @{ |
43 | 44 | DomainName = 'ContosoLtd' |
|
432 | 433 | } |
433 | 434 | } |
434 | 435 |
|
435 | | - Context "$($Global:DSCResourceName)\Get-TargetResource" { |
| 436 | + Context "$($script:DSCResourceName)\Get-TargetResource" { |
436 | 437 | It 'should not throw' { |
437 | 438 | { |
438 | 439 | Get-TargetResource ` |
|
467 | 468 | } |
468 | 469 | } |
469 | 470 |
|
470 | | - Context "$($Global:DSCResourceName)\Set-TargetResource" { |
| 471 | + Context "$($script:DSCResourceName)\Set-TargetResource" { |
471 | 472 | Mock -CommandName Rename-Computer |
472 | 473 | Mock -CommandName Add-Computer |
473 | 474 | Mock -CommandName Set-CimInstance |
|
0 commit comments