fixed get-date tests
This commit is contained in:
parent
c55e5cbc88
commit
9493af81af
1 changed files with 22 additions and 8 deletions
|
@ -11,13 +11,27 @@ Describe "Test-Get-Date" {
|
||||||
(Get-Date).GetType().Name.Equals('DateTime') | Should Be $true
|
(Get-Date).GetType().Name.Equals('DateTime') | Should Be $true
|
||||||
}
|
}
|
||||||
|
|
||||||
It "Should filter properly when displayhint switch is used" {
|
It "Should have colons when ToString method is used" {
|
||||||
(Get-Date -DisplayHint Time).ToString().Contains(":") |Should be $true
|
(Get-Date).ToString().Contains(":") | Should be $true
|
||||||
(Get-Date -DisplayHint Date).ToString().Contains(":") | Should be $false
|
(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" {
|
It "Should be able to use the format flag" {
|
||||||
$timestamp = Get-Date -Format o | foreach {$_ -replace ":", "."}
|
# You would think that one could use simple loops here, but apparently powershell in windows returns different values in loops
|
||||||
$timestamp.ToString().Contains(":") | Should be $false
|
|
||||||
|
(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
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue