Skip to content

Commit 30dcdd5

Browse files
committed
Make date fallback test culture aware
1 parent d8bb53b commit 30dcdd5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Tests/Common/HardcodedMiniHumanizerTests.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,21 @@ public void Minutes(double minutes, string expected)
108108
[TestCase(60, "In 2 days")]
109109
[TestCase(-62, "3 days ago")]
110110
[TestCase(62, "In 3 days")]
111-
[TestCase(-300, "19.12.2019 22:00")]
112-
[TestCase(300, "13.01.2020 22:00")]
113111
public void Hours(double hours, string expected)
114112
{
115113
var value = _humanizer.HumanizeTimestamp(_clock.Now.AddHours(hours));
116114
value.Should().Be(expected);
117115
}
116+
117+
[Test]
118+
public void Date_Fallback()
119+
{
120+
var value = _humanizer.HumanizeTimestamp(_clock.Now.AddHours(-300));
121+
value.Should().Be(new DateTime(2019, 12, 19, 22, 00, 00).ToString("g"));
122+
123+
value = _humanizer.HumanizeTimestamp(_clock.Now.AddHours(300));
124+
value.Should().Be(new DateTime(2020, 01, 13, 22, 00, 00).ToString("g"));
125+
}
118126
}
119127
}
120128
}

0 commit comments

Comments
 (0)