public void IncludeHours_WhenInvoked_ShouldIncludeHours(DateTime subject) { subject.AsDateTime().IncludeHours().With12HrSingleDigit().Format().ShouldEqual(subject.ToString("%h")); subject.AsDateTime().IncludeHours().With12HrDoubleDigit().Format().ShouldEqual(subject.ToString("hh")); subject.AsDateTime().IncludeHours().With24HrSingleDigit().Format().ShouldEqual(subject.ToString("%H")); subject.AsDateTime().IncludeHours().With24HrDoubleDigit().Format().ShouldEqual(subject.ToString("HH")); }
public void IncludeMilliseconds_WhenInvoked_ShouldIncludeMillisecondsInString(DateTime subject) { subject.AsDateTime().IncludeMilliSeconds().InTenthsOfASecond().Format().ShouldEqual(subject.ToString("%f")); subject.AsDateTime().IncludeMilliSeconds().InHundredthsOfASecond().Format().ShouldEqual(subject.ToString("ff")); subject.AsDateTime().IncludeMilliSeconds().InMilliseconds().Format().ShouldEqual(subject.ToString("fff")); subject.AsDateTime().IncludeMilliSeconds().InTenThousandthsOfASecond().Format().ShouldEqual(subject.ToString("ffff")); subject.AsDateTime().IncludeMilliSeconds().InHundredThousandthsOfASecond().Format().ShouldEqual(subject.ToString("fffff")); subject.AsDateTime().IncludeMilliSeconds().InMillionthsOfASecond().Format().ShouldEqual(subject.ToString("ffffff")); subject.AsDateTime().IncludeMilliSeconds().InTenMillionthsOfASecond().Format().ShouldEqual(subject.ToString("fffffff")); subject.AsDateTime().IncludeMilliSeconds().InTenthsOfASecondWithoutZeroes().Format().ShouldEqual(subject.ToString("%F")); subject.AsDateTime().IncludeMilliSeconds().InHundredthsOfASecondWithoutZeroes().Format().ShouldEqual(subject.ToString("FF")); subject.AsDateTime().IncludeMilliSeconds().InMillisecondsWithoutZeroes().Format().ShouldEqual(subject.ToString("FFF")); subject.AsDateTime().IncludeMilliSeconds().InTenThousandthsOfASecondWithoutZeroes().Format().ShouldEqual(subject.ToString("FFFF")); subject.AsDateTime().IncludeMilliSeconds().InHundredThousandthsOfASecondWithoutZeroes().Format().ShouldEqual(subject.ToString("FFFFF")); subject.AsDateTime().IncludeMilliSeconds().InMillionthsOfASecondWithoutZeroes().Format().ShouldEqual(subject.ToString("FFFFFF")); subject.AsDateTime().IncludeMilliSeconds().InTenMillionthsOfASecondWithoutZeroes().Format().ShouldEqual(subject.ToString("FFFFFFF")); }
public void IncludeAmPmSpecifier_WhenInvoked_ShouldIncludeAmOrPm(DateTime subject) { subject.AsDateTime().IncludeAmPmSpecifier().WithSingleCharacter().Format().ShouldEqual(subject.ToString("%t")); subject.AsDateTime().IncludeAmPmSpecifier().WithTwoCharacters().Format().ShouldEqual(subject.ToString("tt")); }
public void WithTwoDigits_WhenInvoked_ShouldReturnTwoDigitYear(DateTime subject) { subject.AsDateTime().IncludeYear().WithTwoDigits().Format().ShouldEqual(subject.ToString("yy")); }
public void WithTwoDigitMonth_WhenInvoked_ShouldReturnTwoDigitMonth(DateTime subject) { subject.AsDateTime().IncludeMonth().WithTwoDigitMonth().Format().ShouldEqual(subject.ToString("MM")); }
public void WithNumericMonth_WhenInvoked_ShouldReturnNumericMonth(DateTime subject) { subject.AsDateTime().IncludeMonth().WithNumericMonth().Format().ShouldEqual(subject.ToString("%M")); }
public void WithFullDayOfWeek_WhenInvoked_ShouldReturnFullDayOfWeek(DateTime subject) { subject.AsDateTime().IncludeDay().WithFullDayOfWeek().Format().ShouldEqual(subject.ToString("dddd")); }
public void IncludeSeconds_WhenInvoked_ShouldIncludeFormattedSeconds(DateTime subject) { subject.AsDateTime().IncludeSeconds().AsSingleDigit().Format().ShouldEqual(subject.ToString("%s")); subject.AsDateTime().IncludeSeconds().AsDoubleDigit().Format().ShouldEqual(subject.ToString("ss")); }
public void WithDelimiter_WhenInvoked_ShouldReturnStringFormattedWithDelimiter(DateTime subject) { subject.AsDateTime().UsingDelimiter(" : ").IncludeYear().WithFourDigits().IncludeMonth().WithAbbreviatedMonth().Format().ShouldEqual(subject.ToString("yyyy : MMM")); subject.AsDateTime().UsingDelimiter("/").IncludeYear().WithFourDigits().IncludeMonth().WithAbbreviatedMonth().Format().ShouldEqual(subject.ToString("yyyy/MMM")); subject.AsDateTime().UsingDelimiter("-").IncludeYear().WithFourDigits().IncludeMonth().WithAbbreviatedMonth().Format().ShouldEqual(subject.ToString("yyyy-MMM")); subject.AsDateTime().UsingDelimiter("+").IncludeYear().WithFourDigits().IncludeMonth().WithAbbreviatedMonth().Format().ShouldEqual(subject.ToString("yyyy+MMM")); subject.AsDateTime().UsingDelimiter(" ").IncludeYear().WithFourDigits().IncludeMonth().WithAbbreviatedMonth().Format().ShouldEqual(subject.ToString("yyyy MMM")); subject.AsDateTime().UsingDelimiter("t").IncludeYear().WithFourDigits().IncludeMonth().WithAbbreviatedMonth().Format().ShouldEqual(subject.ToString("yyyy\\tMMM")); }
public void WithAtLeastOneDigit_WhenInvoked_ShouldReturnOneDigit(DateTime subject) { subject.AsDateTime().IncludeDay().WithAtLeastOneDigit().Format().ShouldEqual(subject.ToString("%d")); }
public void WithAbbrebiatedMonth_WhenInvoked_ShouldReturnAbbreviatedMonth(DateTime subject) { subject.AsDateTime().IncludeMonth().WithAbbreviatedMonth().Format().ShouldEqual(subject.ToString("MMM")); }
public void InsertCustomDelimiter_WhenInvoked_ShouldInsertDelimiterAtSpecifiedPoint(DateTime subject) { subject.AsDateTime() .IncludeYear().WithFourDigits().InsertCustomDelimiter(", ") .IncludeMonth().WithFullMonth() .IncludeDay().WithAtLeastOneDigit() .Format().ShouldEqual(subject.ToString("yyyy, MMMM d")); subject.AsDateTime() .IncludeYear().WithFourDigits() .IncludeMonth().WithFullMonth().InsertCustomDelimiter(":") .IncludeDay().WithAtLeastOneDigit() .Format().ShouldEqual(subject.ToString("yyyy MMMM:d")); subject.AsDateTime() .IncludeYear().WithFourDigits() .IncludeMonth().WithFullMonth() .IncludeDay().WithAtLeastOneDigit().InsertCustomDelimiter("!") .Format().ShouldEqual(subject.ToString("yyyy MMMM d!")); subject.AsDateTime() .IncludeYear().WithFourDigits() .IncludeMonth().WithFullMonth() .IncludeDay().WithAtLeastOneDigit().InsertCustomDelimiter("t") .Format().ShouldEqual(subject.ToString("yyyy MMMM d\\t")); }
public void IncludeUtcOffset_WhenInvoked_ShouldIncludeUtcOffset(DateTime subject) { subject.AsDateTime().IncludeUtcOffset().WithSingleDigitHours().Format().ShouldEqual(subject.ToString("%z")); subject.AsDateTime().IncludeUtcOffset().WithDoubleDigitHours().Format().ShouldEqual(subject.ToString("zz")); subject.AsDateTime().IncludeUtcOffset().WithHourAndMinutesOffset().Format().ShouldEqual(subject.ToString("zzz")); }
public void IncludeTimeZone_WhenInvoked_ShouldIncludeTimeZone(DateTime subject) { subject.AsDateTime().IncludeTimeZone().Format().ShouldEqual(subject.ToString("%K")); }
public void IncludeTimePeriod_WhenInvoked_ShouldIncludeTimePeriod(DateTime subject) { subject.AsDateTime().IncludeTimePeriod().Format().ShouldEqual(subject.ToString("%g")); }
public void WithDigits_WhenInvoked_ShouldReturnStringFormattedWithProperDigits(DateTime subject) { subject.AsDateTime().IncludeYear().WithDigits(7).Format().ShouldEqual(subject.ToString("yyyyyyy")); subject.AsDateTime().IncludeYear().WithDigits(8).Format().ShouldEqual(subject.ToString("yyyyyyyy")); subject.AsDateTime().IncludeYear().WithDigits(9).Format().ShouldEqual(subject.ToString("yyyyyyyyy")); }
public void IncludeMinutes_WhenInvoked_ShouldIncludeMinutesFormatted(DateTime subject) { subject.AsDateTime().IncludeMinutes().WithSingleDigit().Format().ShouldEqual(subject.ToString("%m")); subject.AsDateTime().IncludeMinutes().WithTwoDigits().Format().ShouldEqual(subject.ToString("mm")); }
public void IncludeMonth_WhenInvokedAfterIncludeYear_ShouldReturnYearThenMonthFormatted(DateTime subject) { subject.AsDateTime().IncludeYear().WithFourDigits().IncludeMonth().WithAbbreviatedMonth().Format().ShouldEqual(subject.ToString("yyyy MMM")); }