Datetimes can differ in milliseconds, but Pester doesn't reflect that. If we write
#!/usr/bin/powershell
Describe "Datetime tests" {
Context "'2016-10-29 08:54:47' is '2016-10-29 08:54:47.001'" {
[datetime]$dt1 = '2016-10-29 08:54:47'
[datetime]$dt2 = '2016-10-29 08:54:47.001'
It "Same?" {
$dt1 | Should Be $dt2
}
}
}
then running it gives
$ ./Datetime.Tests.ps1
Describing Datetime tests
Context '2016-10-29 08:54:47' is '2016-10-29 08:54:47.001'
[-] Same? 1.34s
Expected: {10/29/2016 08:54:47}
But was: {10/29/2016 08:54:47}
at line: 8 in /home/tim/posh/Datetime.Tests.ps1
8: $dt1 | Should Be $dt2
Can we make Pester give more information in the "Expected" and "But was" lines?
Datetimes can differ in milliseconds, but Pester doesn't reflect that. If we write
then running it gives
Can we make Pester give more information in the "Expected" and "But was" lines?