Skip to content

Commit 5ee2aa8

Browse files
committed
Fix unit tests
1 parent ad2b005 commit 5ee2aa8

File tree

3 files changed

+401
-4
lines changed

3 files changed

+401
-4
lines changed

source/Classes/020.SqlRSSetup.ps1

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ class SqlRSSetup : ResourceBase
431431
# Verify that the instance name is valid.
432432
if ($properties.InstanceName -notin @('SSRS', 'PBIRS'))
433433
{
434-
New-ArgumentException -ArgumentName 'InstanceName' -Message $this.localizedData.InstanceName_Invalid
434+
New-ArgumentException -ArgumentName 'InstanceName' -Message ($this.localizedData.InstanceName_Invalid -f $properties.InstanceName)
435435
}
436436

437437
# Verify that AcceptLicensingTerms is specified for Install and Repair actions.
@@ -450,10 +450,17 @@ class SqlRSSetup : ResourceBase
450450
Assert-BoundParameter @assertBoundParameterParameters
451451

452452
# Verify that MediaPath is valid.
453-
if (-not (Test-Path -Path $properties.MediaPath) -or (Get-Item -Path $properties.MediaPath).Extension -ne '.exe')
453+
if (-not (Test-Path -Path $properties.MediaPath))
454454
{
455455
New-ArgumentException -ArgumentName 'MediaPath' -Message (
456-
$this.localizedData.MediaPath_Invalid -f $this.MediaPath
456+
$this.localizedData.MediaPath_Invalid -f $properties.MediaPath
457+
)
458+
}
459+
460+
if ((Test-Path -Path $properties.MediaPath) -and (Get-Item -Path $properties.MediaPath).Extension -ne '.exe')
461+
{
462+
New-ArgumentException -ArgumentName 'MediaPath' -Message (
463+
$this.localizedData.MediaPath_DoesNotHaveRequiredExtension -f $properties.MediaPath
457464
)
458465
}
459466

@@ -464,7 +471,7 @@ class SqlRSSetup : ResourceBase
464471
}
465472

466473
# EditionUpgrade requires either ProductKey or Edition for Install and Repair actions.
467-
if ($properties.Action -in @('Install', 'Repair') -and $properties.EditionUpgrade -and -not ($properties.ProductKey -or $properties.Edition))
474+
if ($properties.Action -in @('Repair') -and $properties.EditionUpgrade -and -not ($properties.ProductKey -or $properties.Edition))
468475
{
469476
New-ArgumentException -ArgumentName 'EditionUpgrade' -Message $this.localizedData.EditionUpgrade_RequiresKeyOrEdition
470477
}

source/en-US/SqlRSSetup.strings.psd1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ ConvertFrom-StringData @'
1515
Instance_Installed = Instance '{0}' is installed.
1616
AcceptLicensingTerms_Required = AcceptLicensingTerms must be set for Install and Repair operations.
1717
MediaPath_Invalid = The media path '{0}' does not exist.
18+
MediaPath_DoesNotHaveRequiredExtension = The media path '{0}' does not reference an executable with the required extension .exe.
1819
EditionOrProductKeyMissing = Neither the parameters Edition or ProductKey was specified.
1920
EditionUpgrade_RequiresKeyOrEdition = EditionUpgrade requires either ProductKey or Edition to be specified.
2021
LogPath_ParentMissing = The parent directory '{0}' for LogPath does not exist.

0 commit comments

Comments
 (0)