public void DefaultStrategy_DaysAgo() { Configurator.DateOnlyHumanizeStrategy = new DefaultDateOnlyHumanizeStrategy(); var inputTime = new DateOnly(2015, 07, 02); var baseTime = new DateOnly(2015, 07, 05); const string expectedResult = "3 days ago"; var actualResult = inputTime.Humanize(baseTime); Assert.Equal(expectedResult, actualResult); }
public void PrecisionStrategy_NextDay() { Configurator.DateOnlyHumanizeStrategy = new PrecisionDateOnlyHumanizeStrategy(0.75); var inputTime = new DateOnly(2015, 07, 05); var baseTime = new DateOnly(2015, 07, 04); const string expectedResult = "tomorrow"; var actualResult = inputTime.Humanize(baseTime); Assert.Equal(expectedResult, actualResult); }
public void DefaultStrategy_MonthApart() { Configurator.DateOnlyHumanizeStrategy = new DefaultDateOnlyHumanizeStrategy(); var inputTime = new DateOnly(2015, 08, 05); var baseTime = new DateOnly(2015, 07, 05); const string expectedResult = "one month from now"; var actualResult = inputTime.Humanize(baseTime); Assert.Equal(expectedResult, actualResult); }
public void Nullable_ExpectSame() { DateOnly?never = new DateOnly(2015, 12, 7); Assert.Equal(never.Value.Humanize(), never.Humanize()); }