diff --git a/.build/TestReferenceRsop.build.ps1 b/.build/TestReferenceRsop.build.ps1 new file mode 100644 index 00000000..f36ab2fc --- /dev/null +++ b/.build/TestReferenceRsop.build.ps1 @@ -0,0 +1,79 @@ +param +( + [Parameter()] + # Base directory of all output (default to 'output') + [System.String] + $OutputDirectory = (property OutputDirectory (Join-Path $BuildRoot 'output')), + + [Parameter()] + [System.Object[]] + $PesterScript = (property PesterScript 'tests'), + + [Parameter()] + [System.Object[]] + $ReferencePesterScript = (property ReferencePesterScript 'ReferenceFiles'), + + [Parameter()] + [string[]] + $excludeTag = (property excludeTag @()), + + [Parameter()] + [int] + $CurrentJobNumber = (property CurrentJobNumber 1), + + [Parameter()] + [int] + $TotalJobCount = (property TotalJobCount 1), + + # Build Configuration object + [Parameter()] + [System.Collections.Hashtable] + $BuildInfo = (property BuildInfo @{ }) +) + +task TestReferenceRsop -if ((Get-FilteredConfigurationData -Datum $datum -Filter { $_.Name -like 'ReferenceConfiguration*' } -ErrorAction SilentlyContinue).AllNodes) { + + $PesterOutputFolder = Get-SamplerAbsolutePath -Path $PesterOutputFolder -RelativeTo $OutputDirectory + "`tPester Output Folder = '$PesterOutputFolder" + if (-not (Test-Path -Path $PesterOutputFolder)) + { + Write-Build -Color 'Yellow' -Text "Creating folder $PesterOutputFolder" + + $null = New-Item -Path $PesterOutputFolder -ItemType 'Directory' -Force -ErrorAction 'Stop' + } + + $ReferencePesterScript = $ReferencePesterScript.Foreach({ + Get-SamplerAbsolutePath -Path $_ -RelativeTo $PesterScript[0] + }) + + Write-Build Green "ReferenceRsop Data Pester Scripts = [$($ReferencePesterScript -join ';')]" + + if (-not (Test-Path -Path $ReferencePesterScript)) + { + Write-Build Yellow "Path for tests '$ReferencePesterScript' does not exist" + return + } + + $testResultsPath = Get-SamplerAbsolutePath -Path ReferenceTestResults.xml -RelativeTo $PesterOutputFolder + + Write-Build DarkGray "TestResultsPath is: $testResultsPath" + Write-Build DarkGray "BuildOutput is: $OutputDirectory" + + Import-Module -Name Pester + $po = New-PesterConfiguration + $po.Run.PassThru = $true + $po.Run.Path = [string[]]$ReferencePesterScript + $po.Output.Verbosity = 'Detailed' + if ($excludeTag) + { + $po.Filter.ExcludeTag = $excludeTag + } + $po.Filter.Tag = 'ReferenceFiles' + $po.TestResult.Enabled = $true + $po.TestResult.OutputFormat = 'NUnitXml' + $po.TestResult.OutputPath = $testResultsPath + $testResults = Invoke-Pester -Configuration $po + + assert ($testResults.FailedCount -eq 0 -and $testResults.FailedBlocksCount -eq 0 -and $testResults.FailedContainersCount -eq 0) + +} diff --git a/CHANGELOG.md b/CHANGELOG.md index cd2e3a39..0a519ebd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,3 +27,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Pipeline YAMLs updated to configure unshallow fetch (Fixes issues with GitVersion). - Added task `Set_PSModulePath` which required adding also `Build_Module_ModuleBuilder` and a `DscWorkshop.psm1` dummy file. +- Added `TestReferenceRsop` task. diff --git a/build.yaml b/build.yaml index 1241b1ee..dcdc2866 100644 --- a/build.yaml +++ b/build.yaml @@ -24,6 +24,7 @@ BuildWorkflow: - LoadDatumConfigData - TestConfigData - CompileDatumRsop + - TestReferenceRsop - Set_PSModulePath - TestDscResources - CompileRootConfiguration diff --git a/source/AllNodes/Dev/ReferenceConfigurationDev.yml b/source/AllNodes/Dev/ReferenceConfigurationDev.yml new file mode 100644 index 00000000..b1dc6011 --- /dev/null +++ b/source/AllNodes/Dev/ReferenceConfigurationDev.yml @@ -0,0 +1,37 @@ +NodeName: '[x={ $Node.Name }=]' +Environment: '[x={ $File.Directory.BaseName } =]' +Role: FileServer +Description: '[x= "$($Node.Role) in $($Node.Environment)" =]' +Location: Frankfurt +Baseline: Server + +ComputerSettings: + Name: '[x={ $Node.NodeName }=]' + Description: '[x= "$($Node.Role) in $($Node.Environment)" =]' + +NetworkIpConfiguration: + Interfaces: + - InterfaceAlias: DscWorkshop 0 + IpAddress: 127.0.0.1 + Prefix: 24 + Gateway: 127.0.0.1 + DnsServer: + - 192.168.111.10 + DisableNetbios: true + +PSDscAllowPlainTextPassword: True +PSDscAllowDomainUser: True + +LcmConfig: + ConfigurationRepositoryWeb: + Server: + ConfigurationNames: '[x={ $Node.NodeName }=]' + +DscTagging: + Layers: + - '[x={ Get-DatumSourceFile -Path $File } =]' + +FilesAndFolders: + Items: + - DestinationPath: Z:\DoesNotWork + Type: Directory diff --git a/source/AllNodes/Prod/ReferenceConfigurationProd.yml b/source/AllNodes/Prod/ReferenceConfigurationProd.yml new file mode 100644 index 00000000..14305b92 --- /dev/null +++ b/source/AllNodes/Prod/ReferenceConfigurationProd.yml @@ -0,0 +1,32 @@ +NodeName: '[x={ $Node.Name }=]' +Environment: '[x={ $File.Directory.BaseName } =]' +Role: FileServer +Description: '[x= "$($Node.Role) in $($Node.Environment)" =]' +Location: Frankfurt +Baseline: Server + +ComputerSettings: + Name: '[x={ $Node.NodeName }=]' + Description: '[x= "$($Node.Role) in $($Node.Environment)" =]' + +NetworkIpConfiguration: + Interfaces: + - InterfaceAlias: DscWorkshop 0 + IpAddress: 127.0.0.3 + Prefix: 24 + Gateway: 127.0.0.3 + DnsServer: + - 192.168.111.10 + DisableNetbios: true + +PSDscAllowPlainTextPassword: True +PSDscAllowDomainUser: True + +LcmConfig: + ConfigurationRepositoryWeb: + Server: + ConfigurationNames: '[x={ $Node.NodeName }=]' + +DscTagging: + Layers: + - '[x={ Get-DatumSourceFile -Path $File } =]' diff --git a/source/AllNodes/Test/ReferenceConfigurationTest.yml b/source/AllNodes/Test/ReferenceConfigurationTest.yml new file mode 100644 index 00000000..2aa81828 --- /dev/null +++ b/source/AllNodes/Test/ReferenceConfigurationTest.yml @@ -0,0 +1,32 @@ +NodeName: '[x={ $Node.Name }=]' +Environment: '[x={ $File.Directory.BaseName } =]' +Role: WebServer +Description: '[x= "$($Node.Role) in $($Node.Environment)" =]' +Location: Singapore +Baseline: Server + +ComputerSettings: + Name: '[x={ $Node.NodeName }=]' + Description: '[x= "$($Node.Role) in $($Node.Environment)" =]' + +NetworkIpConfiguration: + Interfaces: + - InterfaceAlias: DscWorkshop 0 + IpAddress: 127.0.0.2 + Prefix: 24 + Gateway: 127.0.0.2 + DnsServer: + - 192.168.111.10 + DisableNetbios: true + +PSDscAllowPlainTextPassword: True +PSDscAllowDomainUser: True + +LcmConfig: + ConfigurationRepositoryWeb: + Server: + ConfigurationNames: '[x={ $Node.NodeName }=]' + +DscTagging: + Layers: + - '[x={ Get-DatumSourceFile -Path $File } =]' diff --git a/source/TestRsopReferences/ReferenceConfigurationDev.yml b/source/TestRsopReferences/ReferenceConfigurationDev.yml new file mode 100644 index 00000000..f506c576 --- /dev/null +++ b/source/TestRsopReferences/ReferenceConfigurationDev.yml @@ -0,0 +1,142 @@ +WindowsFeatures: + Names: + - File-Services + - -Telnet-Client +Description: 'FileServer in ' +DscDiagnostic: {} +Name: ReferenceConfigurationDev +DscLcmController: + MonitorInterval: 00:15:00 + SendDscTaggingData: true + AutoCorrectInterval: 00:30:00 + MaintenanceWindowMode: AutoCorrect + RefreshIntervalOverride: false + MaintenanceWindowOverride: false + ControllerInterval: 00:05:00 + RefreshInterval: 00:30:00 + MaxLcmRuntime: 00:30:00 + LogHistoryTimeSpan: 7.00:00:00 + WriteTranscripts: true + AutoCorrectIntervalOverride: false +PSDscAllowPlainTextPassword: true +PSDscAllowDomainUser: true +ComputerSettings: + Name: ReferenceConfigurationDev + Description: 'FileServer in ' + TimeZone: Greenwich Standard Time + DomainName: contoso.com + JoinOU: CN=Computers,dc=contoso,dc=com + Credential: install@contoso:********* +DscLcmMaintenanceWindows: + MaintenanceWindows: + Name: Always + StartTime: 00:00:00 + Timespan: 24:00:00 + DependsOn: '[DscLcmController]DscLcmController' +Configurations: +- FilesAndFolders +- RegistryValues +- SecurityBase +- WindowsFeatures +- ComputerSettings +- NetworkIpConfiguration +- WindowsEventLogs +- DscLcmController +- DscLcmMaintenanceWindows +- DscTagging +- DscDiagnostic +SecurityBase: + DependsOn: '[WindowsFeatures]WindowsFeatures' + Role: Baseline +Baseline: Server +NetworkIpConfiguration: + Interfaces: + DnsServer: 192.168.111.10 + Gateway: 127.0.0.1 + DisableNetbios: true + Prefix: 24 + InterfaceAlias: DscWorkshop 0 + IpAddress: 127.0.0.1 +DscTagging: + Environment: Dev + Version: 0.3.0 + Layers: + - AllNodes\Dev\ReferenceConfigurationDev + - Environment\Dev + - Locations\Frankfurt + - Roles\FileServer + - Baselines\Security + - Baselines\Server + - Baselines\DscLcm +FilesAndFolders: + Items: + - DestinationPath: Z:\DoesNotWork + Type: Directory + - DestinationPath: C:\Test\Dev-Environment + Type: Directory + - DestinationPath: C:\Test\Frankfurt + Type: Directory + - DestinationPath: C:\Test + Type: Directory + - Contents: Some test data + Type: File + DependsOn: '[File]file_C__Test' + DestinationPath: C:\Test\Test1File1.txt + - Contents: Some test data + Type: File + DependsOn: '[File]file_C__Test' + DestinationPath: C:\Test\Test1File2.txt + - DestinationPath: C:\GpoBackup + Type: Directory + SourcePath: '\\DSCDC01\SYSVOL\contoso.com\Policies' +NodeName: ReferenceConfigurationDev +Environment: Dev +Location: Frankfurt +RegistryValues: + DependsOn: '[FilesAndFolders]FilesAndFolders' + Values: + - ValueName: DBFlag + ValueType: DWORD + ValueData: 545325055 + Ensure: Present + Force: true + Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters + - ValueName: NtpServer + ValueType: String + ValueData: pool.ntp.org,0x9 + Ensure: Present + Force: true + Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters +LcmConfig: + ConfigurationRepositoryWeb: + Server: + ConfigurationNames: ReferenceConfigurationDev + RegistrationKey: ec717ee9-b343-49ee-98a2-26e53939eecf + ServerURL: https://dscpull01.contoso.com:8080/PSDSCPullServer.svc + ReportServerWeb: + RegistrationKey: ec717ee9-b343-49ee-98a2-26e53939eecf + ServerURL: https://dscpull01.contoso.com:8080/PSDSCPullServer.svc + Settings: + RefreshFrequencyMins: 30 + AllowModuleOverwrite: true + ActionAfterReboot: ContinueConfiguration + RefreshMode: Pull + RebootNodeIfNeeded: true + ConfigurationMode: ApplyAndMonitor + ConfigurationModeFrequencyMins: 30 +Role: FileServer +WindowsEventLogs: + Logs: + - LogMode: Circular + IsEnabled: true + LogName: System + MaximumSizeInBytes: 20971520 + - LogMode: Circular + IsEnabled: true + LogName: Application + MaximumSizeInBytes: 20971520 + - LogMode: Circular + IsEnabled: true + LogName: Security + MaximumSizeInBytes: 134217728 + DependsOn: '[ComputerSettings]ComputerSettings' diff --git a/source/TestRsopReferences/ReferenceConfigurationProd.yml b/source/TestRsopReferences/ReferenceConfigurationProd.yml new file mode 100644 index 00000000..4cb907c4 --- /dev/null +++ b/source/TestRsopReferences/ReferenceConfigurationProd.yml @@ -0,0 +1,134 @@ +WindowsFeatures: + Names: + - File-Services + - -Telnet-Client +Description: 'FileServer in ' +DscDiagnostic: {} +Name: ReferenceConfigurationProd +DscLcmController: + MonitorInterval: 00:15:00 + SendDscTaggingData: true + AutoCorrectInterval: 00:30:00 + MaintenanceWindowMode: AutoCorrect + RefreshIntervalOverride: false + MaintenanceWindowOverride: false + ControllerInterval: 00:05:00 + RefreshInterval: 00:30:00 + MaxLcmRuntime: 00:30:00 + LogHistoryTimeSpan: 7.00:00:00 + WriteTranscripts: true + AutoCorrectIntervalOverride: false +PSDscAllowPlainTextPassword: true +PSDscAllowDomainUser: true +ComputerSettings: + Name: ReferenceConfigurationProd + Description: 'FileServer in ' + TimeZone: Greenwich Standard Time + DomainName: contoso.com + JoinOU: CN=Computers,dc=contoso,dc=com + Credential: install@contoso:********* +DscLcmMaintenanceWindows: + MaintenanceWindows: + Name: Always + StartTime: 00:00:00 + Timespan: 24:00:00 + DependsOn: '[DscLcmController]DscLcmController' +Configurations: +- FilesAndFolders +- RegistryValues +- SecurityBase +- WindowsFeatures +- ComputerSettings +- NetworkIpConfiguration +- WindowsEventLogs +- DscLcmController +- DscLcmMaintenanceWindows +- DscTagging +- DscDiagnostic +SecurityBase: + DependsOn: '[WindowsFeatures]WindowsFeatures' + Role: Baseline +Baseline: Server +NetworkIpConfiguration: + Interfaces: + DnsServer: 192.168.111.10 + Gateway: 127.0.0.3 + DisableNetbios: true + Prefix: 24 + InterfaceAlias: DscWorkshop 0 + IpAddress: 127.0.0.3 +DscTagging: + Environment: Prod + Version: 0.3.0 + Layers: + - AllNodes\Prod\ReferenceConfigurationProd + - Environment\Prod + - Locations\Frankfurt + - Roles\FileServer + - Baselines\Security + - Baselines\Server + - Baselines\DscLcm +FilesAndFolders: + Items: + - DestinationPath: C:\Test\Prod-Environment + Type: Directory + - DestinationPath: C:\Test\Frankfurt + Type: Directory + - DestinationPath: C:\Test + Type: Directory + - Contents: Some test data + Type: File + DependsOn: '[File]file_C__Test' + DestinationPath: C:\Test\Test1File1.txt + - Contents: Some test data + Type: File + DependsOn: '[File]file_C__Test' + DestinationPath: C:\Test\Test1File2.txt + - DestinationPath: C:\GpoBackup + Type: Directory + SourcePath: '\\DSCDC01\SYSVOL\contoso.com\Policies' +NodeName: ReferenceConfigurationProd +Environment: Prod +Location: Frankfurt +RegistryValues: + DependsOn: '[FilesAndFolders]FilesAndFolders' + Values: + ValueName: NtpServer + ValueType: String + ValueData: pool.ntp.org,0x9 + Ensure: Present + Force: true + Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters +LcmConfig: + ConfigurationRepositoryWeb: + Server: + ConfigurationNames: ReferenceConfigurationProd + RegistrationKey: ec717ee9-b343-49ee-98a2-26e53939eecf + ServerURL: https://dscpull01.contoso.com:8080/PSDSCPullServer.svc + ReportServerWeb: + RegistrationKey: ec717ee9-b343-49ee-98a2-26e53939eecf + ServerURL: https://dscpull01.contoso.com:8080/PSDSCPullServer.svc + Settings: + RefreshFrequencyMins: 30 + AllowModuleOverwrite: true + ActionAfterReboot: ContinueConfiguration + RefreshMode: Pull + RebootNodeIfNeeded: true + ConfigurationMode: ApplyAndMonitor + ConfigurationModeFrequencyMins: 30 +Role: FileServer +WindowsEventLogs: + Logs: + - LogMode: Circular + IsEnabled: true + LogName: System + MaximumSizeInBytes: 20971520 + - LogMode: Circular + IsEnabled: true + LogName: Application + MaximumSizeInBytes: 20971520 + - LogMode: Circular + IsEnabled: true + LogName: Security + MaximumSizeInBytes: 134217728 + DependsOn: '[ComputerSettings]ComputerSettings' diff --git a/source/TestRsopReferences/ReferenceConfigurationTest.yml b/source/TestRsopReferences/ReferenceConfigurationTest.yml new file mode 100644 index 00000000..9d0132fa --- /dev/null +++ b/source/TestRsopReferences/ReferenceConfigurationTest.yml @@ -0,0 +1,171 @@ +WindowsFeatures: + Names: + - +Web-Server + - -WoW64-Support + - -Telnet-Client +Description: 'WebServer in ' +DscDiagnostic: {} +Name: ReferenceConfigurationTest +DscLcmController: + MonitorInterval: 00:15:00 + SendDscTaggingData: true + AutoCorrectInterval: 00:30:00 + MaintenanceWindowMode: AutoCorrect + RefreshIntervalOverride: false + MaintenanceWindowOverride: false + ControllerInterval: 00:05:00 + RefreshInterval: 00:30:00 + MaxLcmRuntime: 00:30:00 + LogHistoryTimeSpan: 7.00:00:00 + WriteTranscripts: true + AutoCorrectIntervalOverride: false +PSDscAllowPlainTextPassword: true +PSDscAllowDomainUser: true +ComputerSettings: + Name: ReferenceConfigurationTest + Description: 'WebServer in ' + TimeZone: Greenwich Standard Time + DomainName: contoso.com + JoinOU: CN=Computers,dc=contoso,dc=com + Credential: install@contoso:********* +DscLcmMaintenanceWindows: + MaintenanceWindows: + Name: Always + StartTime: 00:00:00 + Timespan: 24:00:00 + DependsOn: '[DscLcmController]DscLcmController' +Configurations: +- FilesAndFolders +- WindowsServices +- RegistryValues +- WebApplicationPools +- WebApplications +- SecurityBase +- WindowsFeatures +- ComputerSettings +- NetworkIpConfiguration +- WindowsEventLogs +- DscLcmController +- DscLcmMaintenanceWindows +- DscTagging +- DscDiagnostic +SecurityBase: + Role: WebServer +Location: Singapore +Baseline: Server +NetworkIpConfiguration: + Interfaces: + DnsServer: 192.168.111.10 + Gateway: 127.0.0.2 + DisableNetbios: true + Prefix: 24 + InterfaceAlias: DscWorkshop 0 + IpAddress: 127.0.0.2 +DscTagging: + Environment: Test + Version: 0.3.0 + Layers: + - AllNodes\Test\ReferenceConfigurationTest + - Environment\Test + - Locations\Singapore + - Roles\WebServer + - Baselines\Security + - Baselines\Server + - Baselines\DscLcm +WindowsServices: + Services: + Path: C:\DummyService.exe + Name: FileDummy + StartupType: Automatic + DisplayName: Dummy Service on Web Servers + DependsOn: '[RegistryValues]RegistryValues' +WebApplicationPools: + Items: + - Name: TestAppPool1 + Ensure: Present + IdentityType: ApplicationPoolIdentity + State: Started + - DependsOn: '[WebAppPool]TestAppPool1' + Name: TestAppPool2 + Ensure: Present + IdentityType: ApplicationPoolIdentity + State: Started + DependsOn: + - '[FilesAndFolders]FilesAndFolders' + - '[WindowsFeatures]WindowsFeatures' +FilesAndFolders: + Items: + - DestinationPath: C:\Test\Test-Environment + Type: Directory + - DestinationPath: C:\Test\Singapore + Type: Directory + - DestinationPath: C:\Inetpub\TestApp1 + Type: Directory + - DestinationPath: C:\Inetpub\TestApp2 + Type: Directory + - Contents: This is TestApp1 + Type: File + DependsOn: '[File]file_C__Inetpub_TestApp1' + DestinationPath: C:\Inetpub\TestApp1\default.html + - Contents: This is TestApp2 + Type: File + DependsOn: '[File]file_C__Inetpub_TestApp2' + DestinationPath: C:\Inetpub\TestApp2\default.html +NodeName: ReferenceConfigurationTest +Environment: Test +WebApplications: + Items: + - WebAppPool: TestAppPool1 + Website: Default Web Site + PhysicalPath: C:\Inetpub\TestApp1 + Ensure: Present + Name: TestApp1 + - PhysicalPath: C:\Inetpub\TestApp2 + Ensure: Present + Name: TestApp2 + Website: Default Web Site + WebAppPool: TestAppPool2 + DependsOn: '[WebApplication]webapp_TestApp1' + DependsOn: '[WebApplicationPools]WebApplicationPools' +RegistryValues: + DependsOn: '[WebApplications]WebApplications' + Values: + ValueName: NtpServer + ValueType: String + ValueData: time.windows.com,0x9; + Ensure: Present + Force: true + Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters +LcmConfig: + ConfigurationRepositoryWeb: + Server: + ConfigurationNames: ReferenceConfigurationTest + RegistrationKey: ec717ee9-b343-49ee-98a2-26e53939eecf + ServerURL: https://dscpull01.contoso.com:8080/PSDSCPullServer.svc + ReportServerWeb: + RegistrationKey: ec717ee9-b343-49ee-98a2-26e53939eecf + ServerURL: https://dscpull01.contoso.com:8080/PSDSCPullServer.svc + Settings: + RefreshFrequencyMins: 30 + AllowModuleOverwrite: true + ActionAfterReboot: ContinueConfiguration + RefreshMode: Pull + RebootNodeIfNeeded: true + ConfigurationMode: ApplyAndMonitor + ConfigurationModeFrequencyMins: 30 +Role: WebServer +WindowsEventLogs: + Logs: + - LogMode: Circular + IsEnabled: true + LogName: System + MaximumSizeInBytes: 20971520 + - LogMode: Circular + IsEnabled: true + LogName: Application + MaximumSizeInBytes: 20971520 + - LogMode: Circular + IsEnabled: true + LogName: Security + MaximumSizeInBytes: 134217728 + DependsOn: '[ComputerSettings]ComputerSettings' diff --git a/tests/ReferenceFiles/TestReferenceFiles.Tests.ps1 b/tests/ReferenceFiles/TestReferenceFiles.Tests.ps1 new file mode 100644 index 00000000..56422cfc --- /dev/null +++ b/tests/ReferenceFiles/TestReferenceFiles.Tests.ps1 @@ -0,0 +1,44 @@ +BeforeDiscovery { + if ($global:Filter -and $global:Filter.ToString() -and -not $Filter.ToString()) + { + $Filter = $global:Filter + } + + $sourcePath = Join-Path -Path $ProjectPath -ChildPath $SourcePath + $sourcePath = Join-Path -Path $sourcePath -ChildPath 'TestRsopReferences' + + $ReferenceRsopFiles = Get-ChildItem -Path $sourcePath -Filter *.yml + $RsopFiles = Get-ChildItem -Path "$OutputDirectory\RSOP" -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.Name -in $ReferenceRsopFiles.Name } + + $allRsopTests = @( + @{ + ReferenceFiles = $ReferenceRsopFiles + RsopFiles = $RsopFiles + } + ) + $individualTests = foreach ($rrf in $ReferenceRsopFiles) + { + @{ + Name = $rrf.Name + File = $rrf + PartnerFile = $RsopFiles | Where-Object { $_.Name -eq $rrf.Name } + } + } +} + +Describe 'Reference Files' -Tag ReferenceFiles { + + It 'All reference files have RSOP files in output folder' -TestCases $allRsopTests { + Write-Verbose "Reference File Count $($ReferenceFiles.Count)" + Write-Verbose "RSOP File Count $($RsopFiles.Count)" + + $ReferenceFiles.Count | Should -Be $RsopFiles.Count + } + + It "Reference file '' should have same checksum as output\RSOP file" -TestCases $individualTests { + $true | Should -Be true + $FilehashRef = (Get-FileHash $File.Fullname).Hash + $FileHashRSOP = (Get-FileHash $PartnerFile.Fullname).Hash + $FilehashRef | Should -Be $FileHashRSOP + } +}