Verify InstalledOn date in correct culture in MSFT_MsiPackage unit test of Get-ProductEntryInfo function

This commit is contained in:
Rastislav Novotný
2017-04-21 01:07:28 +02:00
parent 91597e8fe3
commit dad5e0ecf8
2 changed files with 3 additions and 3 deletions
@@ -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
{
+2 -2
View File
@@ -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' }