public void can_be_compared()
{
AssertTimesAreAscending(new[]
{
new PostedTime(TimeSpan.FromSeconds(50), PostedTimeType.Normal, 1),
new PostedTime(TimeSpan.FromSeconds(60), PostedTimeType.Normal, 1),
new PostedTime(TimeSpan.FromSeconds(70), PostedTimeType.Normal, 1)
});
// Type should be taken into account if the times are equal.
AssertTimesAreAscending(new[]
{
new PostedTime(TimeSpan.FromSeconds(90), PostedTimeType.SessionBest, 1),
new PostedTime(TimeSpan.FromSeconds(90), PostedTimeType.PersonalBest, 1),
new PostedTime(TimeSpan.FromSeconds(90), PostedTimeType.Normal, 1)
});
// Lap number should be taken into account if the time and type are equal.
AssertTimesAreAscending(new[]
{
new PostedTime(TimeSpan.FromSeconds(90), PostedTimeType.Normal, 1),
new PostedTime(TimeSpan.FromSeconds(90), PostedTimeType.Normal, 2),
new PostedTime(TimeSpan.FromSeconds(90), PostedTimeType.Normal, 3)
});
// Although, type should take presedence over lap number.
AssertTimesAreAscending(new[]
{
new PostedTime(TimeSpan.FromSeconds(90), PostedTimeType.SessionBest, 10),
new PostedTime(TimeSpan.FromSeconds(90), PostedTimeType.PersonalBest, 5),
new PostedTime(TimeSpan.FromSeconds(90), PostedTimeType.Normal, 1)
});
// And time should take presedence over both.
AssertTimesAreAscending(new[]
{
new PostedTime(TimeSpan.FromSeconds(50), PostedTimeType.Normal, 1),
new PostedTime(TimeSpan.FromSeconds(60), PostedTimeType.PersonalBest, 5),
new PostedTime(TimeSpan.FromSeconds(70), PostedTimeType.SessionBest, 10),
});
}