@@ -481,14 +481,12 @@ Describe 'Get-SqlDscRSSetupConfiguration' {
481481 }
482482
483483 Mock - CommandName Get-CimInstance - MockWith {
484- return @ (
485- [PSCustomObject ] @ {
486- EditionID = 610778273
487- EditionName = ' SQL Server Developer'
488- IsSharePointIntegrated = $false
489- InstanceId = ' MSRS13.MSSQLSERVER'
490- }
491- )
484+ return [PSCustomObject ] @ {
485+ EditionID = 610778273
486+ EditionName = ' SQL Server Developer'
487+ IsSharePointIntegrated = $false
488+ InstanceId = ' MSRS13.MSSQLSERVER'
489+ }
492490 }
493491 }
494492
@@ -513,12 +511,60 @@ Describe 'Get-SqlDscRSSetupConfiguration' {
513511
514512 # Verify that registry paths used InstanceId, not InstanceName
515513 Should - Invoke - CommandName Get-RegistryPropertyValue - ParameterFilter {
516- $Path -like ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER*'
517- } - Exactly - Times 10
514+ $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\Setup' -and
515+ $Name -eq ' InstallRootDirectory'
516+ } - Exactly - Times 1
517+
518+ Should - Invoke - CommandName Get-RegistryPropertyValue - ParameterFilter {
519+ $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\Setup' -and
520+ $Name -eq ' SQLPath'
521+ } - Exactly - Times 1
522+
523+ Should - Invoke - CommandName Get-RegistryPropertyValue - ParameterFilter {
524+ $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\Setup' -and
525+ $Name -eq ' ServiceName'
526+ } - Exactly - Times 1
527+
528+ Should - Invoke - CommandName Get-RegistryPropertyValue - ParameterFilter {
529+ $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\Setup' -and
530+ $Name -eq ' RSVirtualRootServer'
531+ } - Exactly - Times 1
532+
533+ Should - Invoke - CommandName Get-RegistryPropertyValue - ParameterFilter {
534+ $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\Setup' -and
535+ $Name -eq ' RsConfigFilePath'
536+ } - Exactly - Times 1
537+
538+ Should - Invoke - CommandName Get-RegistryPropertyValue - ParameterFilter {
539+ $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\CPE' -and
540+ $Name -eq ' ErrorDumpDir'
541+ } - Exactly - Times 1
542+
543+ Should - Invoke - CommandName Get-RegistryPropertyValue - ParameterFilter {
544+ $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\CPE' -and
545+ $Name -eq ' CustomerFeedback'
546+ } - Exactly - Times 1
547+
548+ Should - Invoke - CommandName Get-RegistryPropertyValue - ParameterFilter {
549+ $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\CPE' -and
550+ $Name -eq ' EnableErrorReporting'
551+ } - Exactly - Times 1
552+
553+ Should - Invoke - CommandName Get-RegistryPropertyValue - ParameterFilter {
554+ $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\MSSQLServer\CurrentVersion' -and
555+ $Name -eq ' CurrentVersion'
556+ } - Exactly - Times 1
557+
558+ Should - Invoke - CommandName Get-RegistryPropertyValue - ParameterFilter {
559+ $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\MSSQLServer\CurrentVersion' -and
560+ $Name -eq ' ProductVersion'
561+ } - Exactly - Times 1
518562
519563 Should - Invoke - CommandName Get-RegistryPropertyValue - ParameterFilter {
520564 $Path -like ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQLSERVER*'
521565 } - Exactly - Times 0
566+
567+ Should - Invoke - CommandName Get-CimInstance - Exactly - Times 1
522568 }
523569 }
524570
@@ -545,10 +591,7 @@ Describe 'Get-SqlDscRSSetupConfiguration' {
545591 return @ ($mockSSRS2016Instance )
546592 }
547593
548- Mock - CommandName Get-RegistryPropertyValue - ParameterFilter {
549- $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\Setup' -and
550- $Name -eq ' InstallRootDirectory'
551- } - MockWith {
594+ Mock - CommandName Get-RegistryPropertyValue - MockWith {
552595 return $null
553596 }
554597
@@ -558,73 +601,6 @@ Describe 'Get-SqlDscRSSetupConfiguration' {
558601 } - MockWith {
559602 return $mockSQLPath
560603 }
561-
562- Mock - CommandName Get-RegistryPropertyValue - ParameterFilter {
563- $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\Setup' -and
564- $Name -eq ' ServiceName'
565- } - MockWith {
566- return $mockServiceName
567- }
568-
569- Mock - CommandName Get-RegistryPropertyValue - ParameterFilter {
570- $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\Setup' -and
571- $Name -eq ' RSVirtualRootServer'
572- } - MockWith {
573- return $mockVirtualRootServer
574- }
575-
576- Mock - CommandName Get-RegistryPropertyValue - ParameterFilter {
577- $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\Setup' -and
578- $Name -eq ' RsConfigFilePath'
579- } - MockWith {
580- return $mockConfigFilePath
581- }
582-
583- Mock - CommandName Get-RegistryPropertyValue - ParameterFilter {
584- $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\CPE' -and
585- $Name -eq ' ErrorDumpDir'
586- } - MockWith {
587- return $mockErrorDumpDirectory
588- }
589-
590- Mock - CommandName Get-RegistryPropertyValue - ParameterFilter {
591- $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\CPE' -and
592- $Name -eq ' CustomerFeedback'
593- } - MockWith {
594- return $mockCustomerFeedback
595- }
596-
597- Mock - CommandName Get-RegistryPropertyValue - ParameterFilter {
598- $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\CPE' -and
599- $Name -eq ' EnableErrorReporting'
600- } - MockWith {
601- return $mockEnableErrorReporting
602- }
603-
604- Mock - CommandName Get-RegistryPropertyValue - ParameterFilter {
605- $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\MSSQLServer\CurrentVersion' -and
606- $Name -eq ' CurrentVersion'
607- } - MockWith {
608- return $mockCurrentVersion
609- }
610-
611- Mock - CommandName Get-RegistryPropertyValue - ParameterFilter {
612- $Path -eq ' HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\MSSQLServer\CurrentVersion' -and
613- $Name -eq ' ProductVersion'
614- } - MockWith {
615- return $mockProductVersion
616- }
617-
618- Mock - CommandName Get-CimInstance - MockWith {
619- return @ (
620- [PSCustomObject ] @ {
621- EditionID = 610778273
622- EditionName = ' SQL Server Developer'
623- IsSharePointIntegrated = $false
624- InstanceId = ' MSRS13.MSSQLSERVER'
625- }
626- )
627- }
628604 }
629605
630606 It ' Should return correct install folder' {
0 commit comments