mirror of
https://github.com/PowerShell/PSDscResources
synced 2026-06-21 13:45:29 +00:00
Verify InstalledOn date in correct culture in MSFT_MsiPackage unit test of Get-ProductEntryInfo function
This commit is contained in:
@@ -626,7 +626,7 @@ function Get-ProductEntryInfo
|
||||
{
|
||||
try
|
||||
{
|
||||
$installDate = '{0:d}' -f [DateTime]::ParseExact($installDate, 'yyyyMMdd',[System.Globalization.CultureInfo]::CurrentCulture).Date
|
||||
$installDate = '{0:d}' -f [DateTime]::ParseExact($installDate, 'yyyyMMdd',[System.Globalization.CultureInfo]::InvariantCulture).Date
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -57,7 +57,7 @@ Describe 'MsiPackage Unit Tests' {
|
||||
$script:mockProductEntryInfo = @{
|
||||
Name = 'TestDisplayName'
|
||||
InstallSource = 'TestInstallSource'
|
||||
InstalledOn = '4/4/2017'
|
||||
InstalledOn = ([DateTime]::new(2017, 4, 24).ToShortDateString())
|
||||
Size = 2048
|
||||
Version = '1.2.3.4'
|
||||
PackageDescription = 'Test Description'
|
||||
@@ -586,7 +586,7 @@ Describe 'MsiPackage Unit Tests' {
|
||||
}
|
||||
|
||||
Describe 'Get-ProductEntryInfo' {
|
||||
Mock -CommandName Get-ProductEntryValue -MockWith { return '20170404' } -ParameterFilter { $Property -eq 'InstallDate' }
|
||||
Mock -CommandName Get-ProductEntryValue -MockWith { return '20170424' } -ParameterFilter { $Property -eq 'InstallDate' }
|
||||
Mock -CommandName Get-ProductEntryValue -MockWith { return $script:mockProductEntryInfo.Publisher } -ParameterFilter { $Property -eq 'Publisher' }
|
||||
Mock -CommandName Get-ProductEntryValue -MockWith { return $script:mockProductEntryInfo.Size } -ParameterFilter { $Property -eq 'EstimatedSize' }
|
||||
Mock -CommandName Get-ProductEntryValue -MockWith { return $script:mockProductEntryInfo.Version } -ParameterFilter { $Property -eq 'DisplayVersion' }
|
||||
|
||||
Reference in New Issue
Block a user