@@ -33,14 +33,6 @@ if (!(Test-RequiredFeaturesInstalled))
3333 return
3434}
3535
36- # Disable Bitlocker on the OS drive before performing any tests
37- $sysDriveBlv = Get-BitLockerVolume - MountPoint $env: SystemDrive
38-
39- if ($sysDriveBlv.KeyProtector.Count -gt 0 -or $sysDriveBlv.ProtectionStatus -ne ' Off' )
40- {
41- Disable-BitLocker - MountPoint $env: SystemDrive
42- }
43-
4436# Using try/finally to always cleanup.
4537try
4638{
4941 . $configurationFile
5042
5143 Describe " $ ( $script :dcsResourceName ) _Integration" {
52- $configurationName = " $ ( $script :dcsResourceName ) _BasicTPMEncryptionOnSysDrive_Config"
53-
54- Context (' When using configuration {0}' -f $configurationName ) {
55- It ' Should compile and apply the MOF without throwing' {
56- {
57- $configurationParameters = @ {
58- OutputPath = $TestDrive
59- ConfigurationData = $ConfigurationData
60- }
61-
62- & $configurationName @configurationParameters
63-
64- $startDscConfigurationParameters = @ {
65- Path = $TestDrive
66- ComputerName = ' localhost'
67- Wait = $true
68- Verbose = $true
69- Force = $true
70- ErrorAction = ' Stop'
71- }
72-
73- Start-DscConfiguration @startDscConfigurationParameters
74- } | Should -Not - Throw
75- }
44+ $configurationNames = @ (
45+ " $ ( $script :dcsResourceName ) _BasicTPMEncryptionOnSysDrive_Config"
46+ " $ ( $script :dcsResourceName ) _TPMEncryptionOnSysDriveWithFalseSwitchParams_Config"
47+ )
48+
49+ foreach ($configurationName in $configurationNames )
50+ {
51+ Context (' When using configuration {0}' -f $configurationName ) {
52+ BeforeAll {
53+ Disable-BitLockerOnTestDrive - MountPoint $env: SystemDrive
54+ }
7655
77- It ' Should be able to call Get-DscConfiguration without throwing' {
78- {
79- $script :currentConfiguration = Get-DscConfiguration - Verbose - ErrorAction Stop
80- } | Should -Not - Throw
81- }
56+ It ' Should compile and apply the MOF without throwing' {
57+ {
58+ $configurationParameters = @ {
59+ OutputPath = $TestDrive
60+ ConfigurationData = $ConfigurationData
61+ }
62+
63+ & $configurationName @configurationParameters
64+
65+ $startDscConfigurationParameters = @ {
66+ Path = $TestDrive
67+ ComputerName = ' localhost'
68+ Wait = $true
69+ Verbose = $true
70+ Force = $true
71+ ErrorAction = ' Stop'
72+ }
73+
74+ Start-DscConfiguration @startDscConfigurationParameters
75+ } | Should -Not - Throw
76+ }
8277
83- It ' Should have set the resource and all the parameters should match ' {
84- $resourceCurrentState = $ script :currentConfiguration | Where-Object - FilterScript {
85- $_ .ConfigurationName -eq $configurationName `
86- -and $_ .ResourceId -eq " [ $ ( $ script :dscResourceFriendlyName ) ]Integration_Test "
78+ It ' Should be able to call Get-DscConfiguration without throwing ' {
79+ {
80+ $ script :currentConfiguration = Get-DscConfiguration - Verbose - ErrorAction Stop
81+ } | Should -Not - Throw
8782 }
8883
89- (Get-BitlockerVolume - MountPoint $env: SystemDrive ).KeyProtector[0 ].KeyProtectorType | Should - Be ' Tpm'
90- }
84+ It ' Should have set the resource and all the parameters should match' {
85+ (Get-BitlockerVolume - MountPoint $env: SystemDrive ).KeyProtector[0 ].KeyProtectorType | Should - Be ' Tpm'
86+ }
9187
92- It ' Should return $true when Test-DscConfiguration is run' {
93- Test-DscConfiguration - Verbose | Should - Be $true
88+ It ' Should return $true when Test-DscConfiguration is run' {
89+ Test-DscConfiguration - Verbose | Should - Be $true
90+ }
9491 }
9592 }
9693 }
0 commit comments