public void DefaultStrategy_HoursAgo() { var inputTime = new TimeOnly(13, 07, 02); var baseTime = new TimeOnly(17, 07, 05); const string expectedResult = "il y a 4 heures"; var actualResult = inputTime.Humanize(baseTime); Assert.Equal(expectedResult, actualResult); }
public void PrecisionStrategy_NextDay() { var inputTime = new TimeOnly(18, 10, 49); var baseTime = new TimeOnly(13, 07, 04); const string expectedResult = "dans 5 heures"; var actualResult = inputTime.Humanize(baseTime); Assert.Equal(expectedResult, actualResult); }
public void DefaultStrategy_HoursApart() { var inputTime = new TimeOnly(13, 08, 05); var baseTime = new TimeOnly(1, 08, 05); const string expectedResult = "dans 12 heures"; var actualResult = inputTime.Humanize(baseTime); Assert.Equal(expectedResult, actualResult); }
public void DefaultStrategy_SameTime() { var inputTime = new TimeOnly(13, 07, 05); var baseTime = new TimeOnly(13, 07, 05); const string expectedResult = "maintenant"; var actualResult = inputTime.Humanize(baseTime); Assert.Equal(expectedResult, actualResult); }
public void PrecisionStrategy_NextDay() { Configurator.TimeOnlyHumanizeStrategy = new PrecisionTimeOnlyHumanizeStrategy(0.75); var inputTime = new TimeOnly(18, 10, 49); var baseTime = new TimeOnly(13, 07, 04); const string expectedResult = "5 hours from now"; var actualResult = inputTime.Humanize(baseTime); Assert.Equal(expectedResult, actualResult); }
public void DefaultStrategy_HoursAgo() { Configurator.TimeOnlyHumanizeStrategy = new DefaultTimeOnlyHumanizeStrategy(); var inputTime = new TimeOnly(13, 07, 02); var baseTime = new TimeOnly(17, 07, 05); const string expectedResult = "4 hours ago"; var actualResult = inputTime.Humanize(baseTime); Assert.Equal(expectedResult, actualResult); }
public void DefaultStrategy_HoursApart() { Configurator.TimeOnlyHumanizeStrategy = new DefaultTimeOnlyHumanizeStrategy(); var inputTime = new TimeOnly(13, 08, 05); var baseTime = new TimeOnly(1, 08, 05); const string expectedResult = "12 hours from now"; var actualResult = inputTime.Humanize(baseTime); Assert.Equal(expectedResult, actualResult); }
public void Nullable_ExpectSame() { TimeOnly?never = new TimeOnly(23, 12, 7); Assert.Equal(never.Value.Humanize(), never.Humanize()); }