Skip to content

Commit 6c25e35

Browse files
authored
Assert-SetupActionProperties: Refactor to use Get-FileVersion (#2374)
1 parent f21f52b commit 6c25e35

File tree

7 files changed

+15
-228
lines changed

7 files changed

+15
-228
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4141

4242
### Changed
4343

44+
- `Assert-SetupActionProperties`
45+
- Refactored to use the command `Get-FileVersion` from the DscResource.Common
46+
module instead of the private function `Get-FileVersionInformation`
47+
([issue #2373](https://github.com/dsccommunity/SqlServerDsc/issues/2373)).
4448
- Renamed commands `*-SqlDscBIReportServer` to `*-SqlDscPowerBIReportServer` for
4549
clarity. The old names `*-SqlDscBIReportServer` and `*-SqlDscPBIReportServer`
4650
are available as aliases for backward compatibility
@@ -117,6 +121,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
117121

118122
### Removed
119123

124+
- Removed private function `Get-FileVersionInformation`. Use the command
125+
`Get-FileVersion` from the DscResource.Common module instead
126+
([issue #2373](https://github.com/dsccommunity/SqlServerDsc/issues/2373)).
120127
- Removed deprecated private function `Get-ProtocolNameProperties` from the
121128
SqlServerDsc.Common module. Use the public command `Get-SqlDscServerProtocolName`
122129
instead ([issue #2104](https://github.com/dsccommunity/SqlServerDsc/issues/2104)).

source/Modules/SqlServerDsc.Common/SqlServerDsc.Common.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1991,7 +1991,7 @@ function ConvertTo-ServerInstanceName
19911991
19921992
.NOTES
19931993
This function should be removed when it is not longer used, and instead
1994-
the private function Get-FileVersionInformation shall be used.
1994+
the command Get-FileVersion from the DscResource.Common module shall be used.
19951995
#>
19961996
function Get-FilePathMajorVersion
19971997
{

source/Private/Assert-SetupActionProperties.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function Assert-SetupActionProperties
4646
{
4747
$setupExecutableFileVersion = $Property.MediaPath |
4848
Join-Path -ChildPath 'setup.exe' |
49-
Get-FileVersionInformation
49+
Get-FileVersion
5050

5151
$Property.Features |
5252
Assert-Feature -ProductVersion $setupExecutableFileVersion.ProductVersion

source/Private/Get-FileVersionInformation.ps1

Lines changed: 0 additions & 66 deletions
This file was deleted.

source/en-US/SqlServerDsc.strings.psd1

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,6 @@ ConvertFrom-StringData @'
249249
## Assert-Feature
250250
Feature_Assert_NotSupportedFeature = The feature '{0}' is not supported for Microsoft SQL Server product version {1}. See the Microsoft SQL Server documentation https://learn.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-from-the-command-prompt#Feature for more information.
251251
252-
## Get-FileVersionInformation
253-
FileVersionInformation_Get_FilePathIsNotFile = The specified path is not a file.
254-
255252
## Get-SqlDscConfigurationOption
256253
ConfigurationOption_Get_Missing = There is no configuration option with the name '{0}'.
257254

tests/Unit/Private/Assert-SetupActionProperties.Tests.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,9 @@ Describe 'Assert-SetupActionProperties' -Tag 'Private' {
388388
Mock -CommandName Assert-Feature
389389

390390
# Required mock for mocking Assert-Feature above.
391-
Mock -CommandName Get-FileVersionInformation -MockWith {
392-
return @{
393-
ProductVersion = 16
391+
Mock -CommandName Get-FileVersion -MockWith {
392+
return [PSCustomObject] @{
393+
ProductVersion = '16.0.1000.6'
394394
}
395395
}
396396
}
@@ -522,9 +522,9 @@ Describe 'Assert-SetupActionProperties' -Tag 'Private' {
522522
Mock -CommandName Assert-Feature
523523

524524
# Required mock for mocking Assert-Feature above.
525-
Mock -CommandName Get-FileVersionInformation -MockWith {
526-
return @{
527-
ProductVersion = 16
525+
Mock -CommandName Get-FileVersion -MockWith {
526+
return [PSCustomObject] @{
527+
ProductVersion = '16.0.1000.6'
528528
}
529529
}
530530
}

tests/Unit/Private/Get-FileVersionInformation.Tests.ps1

Lines changed: 0 additions & 151 deletions
This file was deleted.

0 commit comments

Comments
 (0)