diff --git a/src/pester-tests/Test-Get-Dates.Tests.ps1 b/src/pester-tests/Test-Get-Dates.Tests.ps1 index 5ac4a068a..1efa3eccd 100644 --- a/src/pester-tests/Test-Get-Dates.Tests.ps1 +++ b/src/pester-tests/Test-Get-Dates.Tests.ps1 @@ -10,14 +10,28 @@ Describe "Test-Get-Date" { It "Should return a DateTime object upon being called" { (Get-Date).GetType().Name.Equals('DateTime') | Should Be $true } - - It "Should filter properly when displayhint switch is used" { - (Get-Date -DisplayHint Time).ToString().Contains(":") |Should be $true - (Get-Date -DisplayHint Date).ToString().Contains(":") | Should be $false + + It "Should have colons when ToString method is used" { + (Get-Date).ToString().Contains(":") | Should be $true + (Get-Date -DisplayHint Time).ToString().Contains(":") | Should be $true + (Get-Date -DisplayHint Date).ToString().Contains(":") | Should be $true } - It "Should be able to pipe the output to another cmdlet" { - $timestamp = Get-Date -Format o | foreach {$_ -replace ":", "."} - $timestamp.ToString().Contains(":") | Should be $false + It "Should be able to use the format flag" { + # You would think that one could use simple loops here, but apparently powershell in windows returns different values in loops + + (Get-Date -Format d).Contains("/") | Should be $true + (Get-Date -Format D).Contains(",") | Should be $true + (Get-Date -Format f).Contains(",") -and (Get-Date -Format f).Contains(":") | Should be $true + (Get-Date -Format F).Contains(",") -and (Get-Date -Format F).Contains(":") | Should be $true + (Get-Date -Format g).Contains("/") -and (Get-Date -Format g).Contains(":") | Should be $true + (Get-Date -Format G).Contains("/") -and (Get-Date -Format G).Contains(":") | Should be $true + (Get-Date -Format m).Contains(",") -or ` + (Get-Date -Format m).Contains(":") -or ` + (Get-Date -Format m).Contains("/") | Should be $false + + } -} + +} +