public void YYInRange13_31PlacedFirstSlashDelimited() { List <string> javaExpectedResult = new() { "yy/MM/dd", "dd/MM/yy", }; List <string> javaResult = Guesser.GuessFormat("13/02/01", Format.Java); Assert.Equal(2, javaResult.Count); Assert.Equal(javaExpectedResult.OrderBy(s => s).ToList(), javaResult.OrderBy(s => s).ToList()); List <string> momentExpectedResult = new() { "YY/MM/DD", "DD/MM/YY", }; List <string> momentResult = Guesser.GuessFormat("13/02/01", Format.Moment); Assert.Equal(2, momentResult.Count); Assert.Equal(momentExpectedResult.OrderBy(s => s).ToList(), momentResult.OrderBy(s => s).ToList()); List <string> linuxExpectedResult = new() { "%y/%m/%d", "%d/%m/%y", }; List <string> linuxResult = Guesser.GuessFormat("13/02/01", Format.Linux); Assert.Equal(2, linuxResult.Count); Assert.Equal(linuxExpectedResult.OrderBy(s => s).ToList(), linuxResult.OrderBy(s => s).ToList()); }
public void MM_DD_YYInRange01_12DotDelimitedWithDotDelimitedTime() { List <string> javaExpectedResult = new() { "yy.MM.dd HH.mm z", "MM.dd.yy HH.mm z", "dd.MM.yy HH.mm z", }; List <string> javaResult = Guesser.GuessFormat("01.02.03 10.00 PDT", Format.Java); Assert.Equal(3, javaResult.Count); Assert.Equal(javaExpectedResult.OrderBy(s => s).ToList(), javaResult.OrderBy(s => s).ToList()); List <string> momentExpectedResult = new() { "YY.MM.DD HH.mm z", "MM.DD.YY HH.mm z", "DD.MM.YY HH.mm z", }; List <string> momentResult = Guesser.GuessFormat("01.02.03 10.00 PDT", Format.Moment); Assert.Equal(3, momentResult.Count); Assert.Equal(momentExpectedResult.OrderBy(s => s).ToList(), momentResult.OrderBy(s => s).ToList()); List <string> linuxExpectedResult = new() { "%y.%m.%d %H.%M %Z", "%d.%m.%y %H.%M %Z", "%m.%d.%y %H.%M %Z", }; List <string> linuxResult = Guesser.GuessFormat("01.02.03 10.00 PDT", Format.Linux); Assert.Equal(3, linuxResult.Count); Assert.Equal(linuxExpectedResult.OrderBy(s => s).ToList(), linuxResult.OrderBy(s => s).ToList()); }
public void MM_DD_YYInRange01_12SlashDelimitedWithTime() { List <string> javaExpectedResult = new() { "yy/MM/dd hh:mm a", "MM/dd/yy hh:mm a", "dd/MM/yy hh:mm a", }; List <string> javaResult = Guesser.GuessFormat("01/02/03 10:00 PM", Format.Java); Assert.Equal(3, javaResult.Count); Assert.Equal(javaExpectedResult.OrderBy(s => s).ToList(), javaResult.OrderBy(s => s).ToList()); List <string> momentExpectedResult = new() { "YY/MM/DD hh:mm A", "MM/DD/YY hh:mm A", "DD/MM/YY hh:mm A", }; List <string> momentResult = Guesser.GuessFormat("01/02/03 10:00 PM", Format.Moment); Assert.Equal(3, momentResult.Count); Assert.Equal(momentExpectedResult.OrderBy(s => s).ToList(), momentResult.OrderBy(s => s).ToList()); List <string> linuxExpectedResult = new() { "%y/%m/%d %I:%M %p", "%d/%m/%y %I:%M %p", "%m/%d/%y %I:%M %p", }; List <string> linuxResult = Guesser.GuessFormat("01/02/03 10:00 PM", Format.Linux); Assert.Equal(3, linuxResult.Count); Assert.Equal(linuxExpectedResult.OrderBy(s => s).ToList(), linuxResult.OrderBy(s => s).ToList()); }
public void MM_DDInRange01_12DashDelimited() { List <string> javaExpectedResult = new() { "MM-dd-yyyy", "dd-MM-yyyy", }; List <string> javaResult = Guesser.GuessFormat("01-02-2020", Format.Java); Assert.Equal(2, javaResult.Count); Assert.Equal(javaExpectedResult.OrderBy(s => s).ToList(), javaResult.OrderBy(s => s).ToList()); List <string> momentExpectedResult = new() { "MM-DD-YYYY", "DD-MM-YYYY", }; List <string> momentResult = Guesser.GuessFormat("01-02-2020", Format.Moment); Assert.Equal(2, momentResult.Count); Assert.Equal(momentExpectedResult.OrderBy(s => s).ToList(), momentResult.OrderBy(s => s).ToList()); List <string> linuxExpectedResult = new() { "%d-%m-%Y", "%m-%d-%Y", }; List <string> linuxResult = Guesser.GuessFormat("01-02-2020", Format.Linux); Assert.Equal(2, linuxResult.Count); Assert.Equal(linuxExpectedResult.OrderBy(s => s).ToList(), linuxResult.OrderBy(s => s).ToList()); }
public void YYInRange13_31PlacedFirstDotDelimited() { List <string> javaExpectedResult = new() { "yy.MM.dd", "dd.MM.yy", "HH.mm.ss", }; List <string> javaResult = Guesser.GuessFormat("13.02.01", Format.Java); Assert.Equal(3, javaResult.Count); Assert.Equal(javaExpectedResult.OrderBy(s => s).ToList(), javaResult.OrderBy(s => s).ToList()); List <string> momentExpectedResult = new() { "YY.MM.DD", "DD.MM.YY", "HH.mm.ss", }; List <string> momentResult = Guesser.GuessFormat("13.02.01", Format.Moment); Assert.Equal(3, momentResult.Count); Assert.Equal(momentExpectedResult.OrderBy(s => s).ToList(), momentResult.OrderBy(s => s).ToList()); List <string> linuxExpectedResult = new() { "%y.%m.%d", "%d.%m.%y", "%H.%M.%S", }; List <string> linuxResult = Guesser.GuessFormat("13.02.01", Format.Linux); Assert.Equal(3, linuxResult.Count); Assert.Equal(linuxExpectedResult.OrderBy(s => s).ToList(), linuxResult.OrderBy(s => s).ToList()); }
public void Dash_DD_MM_YY_MM() { List <string> javaExpectedResult = new() { "dd-MM", "yy-MM", }; List <string> javaResult = Guesser.GuessFormat("31-12", Format.Java); Assert.Equal(2, javaResult.Count); Assert.Equal(javaExpectedResult.OrderBy(s => s).ToList(), javaResult.OrderBy(s => s).ToList()); List <string> momentExpectedResult = new() { "DD-MM", "YY-MM", }; List <string> momentResult = Guesser.GuessFormat("31-12", Format.Moment); Assert.Equal(2, momentResult.Count); Assert.Equal(momentExpectedResult.OrderBy(s => s).ToList(), momentResult.OrderBy(s => s).ToList()); List <string> linuxExpectedResult = new() { "%y-%m", "%d-%m", }; List <string> linuxResult = Guesser.GuessFormat("31-12", Format.Linux); Assert.Equal(2, linuxResult.Count); Assert.Equal(linuxExpectedResult.OrderBy(s => s).ToList(), linuxResult.OrderBy(s => s).ToList()); }
public void MM_DDInRange01_12SlashDelimited() { List <string> javaExpectedResult = new() { "MM/dd/yyyy", "dd/MM/yyyy", }; List <string> javaResult = Guesser.GuessFormat("01/02/2020", Format.Java); Assert.Equal(2, javaResult.Count); Assert.Equal(javaExpectedResult.OrderBy(s => s).ToList(), javaResult.OrderBy(s => s).ToList()); List <string> momentExpectedResult = new() { "MM/DD/YYYY", "DD/MM/YYYY", }; List <string> momentResult = Guesser.GuessFormat("01/02/2020", Format.Moment); Assert.Equal(2, momentResult.Count); Assert.Equal(momentExpectedResult.OrderBy(s => s).ToList(), momentResult.OrderBy(s => s).ToList()); List <string> linuxExpectedResult = new() { "%d/%m/%Y", "%m/%d/%Y", }; List <string> linuxResult = Guesser.GuessFormat("01/02/2020", Format.Linux); Assert.Equal(2, linuxResult.Count); Assert.Equal(linuxExpectedResult.OrderBy(s => s).ToList(), linuxResult.OrderBy(s => s).ToList()); }
public void Dot_MM_DD() { List <string> javaExpectedResult = new() { "MM.dd", "HH.mm", }; List <string> javaResult = Guesser.GuessFormat("12.31", Format.Java); Assert.Equal(2, javaResult.Count); Assert.Equal(javaExpectedResult.OrderBy(s => s).ToList(), javaResult.OrderBy(s => s).ToList()); List <string> momentExpectedResult = new() { "MM.DD", "HH.mm", }; List <string> momentResult = Guesser.GuessFormat("12.31", Format.Moment); Assert.Equal(2, momentResult.Count); Assert.Equal(momentExpectedResult.OrderBy(s => s).ToList(), momentResult.OrderBy(s => s).ToList()); List <string> linuxExpectedResult = new() { "%m.%d", "%H.%M", }; List <string> linuxResult = Guesser.GuessFormat("12.31", Format.Linux); Assert.Equal(2, linuxResult.Count); Assert.Equal(linuxExpectedResult.OrderBy(s => s).ToList(), linuxResult.OrderBy(s => s).ToList()); }
public void MM_DDInRange01_12DotDelimited() { List <string> javaExpectedResult = new() { "MM.dd.yyyy", "dd.MM.yyyy", }; List <string> javaResult = Guesser.GuessFormat("01.02.2020", Format.Java); Assert.Equal(2, javaResult.Count); Assert.Equal(javaExpectedResult.OrderBy(s => s).ToList(), javaResult.OrderBy(s => s).ToList()); List <string> momentExpectedResult = new() { "MM.DD.YYYY", "DD.MM.YYYY", }; List <string> momentResult = Guesser.GuessFormat("01.02.2020", Format.Moment); Assert.Equal(2, momentResult.Count); Assert.Equal(momentExpectedResult.OrderBy(s => s).ToList(), momentResult.OrderBy(s => s).ToList()); List <string> linuxExpectedResult = new() { "%d.%m.%Y", "%m.%d.%Y", }; List <string> linuxResult = Guesser.GuessFormat("01.02.2020", Format.Linux); Assert.Equal(2, linuxResult.Count); Assert.Equal(linuxExpectedResult.OrderBy(s => s).ToList(), linuxResult.OrderBy(s => s).ToList()); }
public void MM_DDInRange01_12ShortFormDashDelimited() { List <string> javaExpectedResult = new() { "yy-MM", "dd-MM", "MM-dd", }; List <string> javaResult = Guesser.GuessFormat("01-01", Format.Java); Assert.Equal(3, javaResult.Count); Assert.Equal(javaExpectedResult.OrderBy(s => s).ToList(), javaResult.OrderBy(s => s).ToList()); List <string> momentExpectedResult = new() { "YY-MM", "DD-MM", "MM-DD", }; List <string> momentResult = Guesser.GuessFormat("01-01", Format.Moment); Assert.Equal(3, momentResult.Count); Assert.Equal(momentExpectedResult.OrderBy(s => s).ToList(), momentResult.OrderBy(s => s).ToList()); List <string> linuxExpectedResult = new() { "%y-%m", "%d-%m", "%m-%d", }; List <string> linuxResult = Guesser.GuessFormat("01-01", Format.Linux); Assert.Equal(3, linuxResult.Count); Assert.Equal(linuxExpectedResult.OrderBy(s => s).ToList(), linuxResult.OrderBy(s => s).ToList()); }
public void MM_DDInRange01_12ShortFormDotDelimited() { List <string> javaExpectedResult = new() { "yy.MM", "dd.MM", "MM.dd", "HH.mm", }; List <string> javaResult = Guesser.GuessFormat("01.01", Format.Java); Assert.Equal(4, javaResult.Count); Assert.Equal(javaExpectedResult.OrderBy(s => s).ToList(), javaResult.OrderBy(s => s).ToList()); List <string> momentExpectedResult = new() { "YY.MM", "DD.MM", "MM.DD", "HH.mm", }; List <string> momentResult = Guesser.GuessFormat("01.01", Format.Moment); Assert.Equal(4, momentResult.Count); Assert.Equal(momentExpectedResult.OrderBy(s => s).ToList(), momentResult.OrderBy(s => s).ToList()); List <string> linuxExpectedResult = new() { "%y.%m", "%d.%m", "%m.%d", "%H.%M", }; List <string> linuxResult = Guesser.GuessFormat("01.01", Format.Linux); Assert.Equal(4, linuxResult.Count); Assert.Equal(linuxExpectedResult.OrderBy(s => s).ToList(), linuxResult.OrderBy(s => s).ToList()); }
public void HoursSingleDigitAndMeridiemWithoutDelimiter12HourFormatAM_PM() { Assert.Equal("ha", Guesser.GuessFormat("5PM", Format.Java).FirstOrDefault()); Assert.Equal("hA", Guesser.GuessFormat("5PM", Format.Moment).FirstOrDefault()); Assert.Equal("%-l%p", Guesser.GuessFormat("5PM", Format.Linux).FirstOrDefault()); }
public void HoursAndMinsColonSep24HourFormat() { Assert.Equal("HH:mm", Guesser.GuessFormat("21:22", Format.Java).FirstOrDefault()); Assert.Equal("HH:mm", Guesser.GuessFormat("21:22", Format.Moment).FirstOrDefault()); Assert.Equal("%H:%M", Guesser.GuessFormat("21:22", Format.Linux).FirstOrDefault()); }
public void HoursDoubleDigit12HourFormatAM_PM() { Assert.Equal("hh a", Guesser.GuessFormat("10 PM", Format.Java).FirstOrDefault()); Assert.Equal("hh A", Guesser.GuessFormat("10 PM", Format.Moment).FirstOrDefault()); Assert.Equal("%I %p", Guesser.GuessFormat("10 PM", Format.Linux).FirstOrDefault()); }
public void HoursMinsSecsDotSep12HourFormatam_pm() { Assert.Equal("hh.mm.ss a", Guesser.GuessFormat("10.00.59 am", Format.Java).FirstOrDefault()); Assert.Equal("hh.mm.ss a", Guesser.GuessFormat("10.00.59 am", Format.Moment).FirstOrDefault()); Assert.Equal("%I.%M.%S %P", Guesser.GuessFormat("10.00.59 am", Format.Linux).FirstOrDefault()); }
public void HoursAndMinsColonSep12HourFormatam_pm() { Assert.Equal("hh:mm a", Guesser.GuessFormat("10:00 am", Format.Java).FirstOrDefault()); Assert.Equal("hh:mm a", Guesser.GuessFormat("10:00 am", Format.Moment).FirstOrDefault()); Assert.Equal("%I:%M %P", Guesser.GuessFormat("10:00 am", Format.Linux).FirstOrDefault()); }
public void HoursMinsSecsAndMillis24HourFormat() { Assert.Equal("HH:mm:ss.SSS", Guesser.GuessFormat("21:22:23.123", Format.Java).FirstOrDefault()); Assert.Equal("HH:mm:ss.SSS", Guesser.GuessFormat("21:22:23.123", Format.Moment).FirstOrDefault()); Assert.Equal("%H:%M:%S.%L", Guesser.GuessFormat("21:22:23.123", Format.Linux).FirstOrDefault()); }
public void HoursMinsAndSecsColonSep24HourFormat() { Assert.Equal("HH:mm:ss", Guesser.GuessFormat("21:22:23", Format.Java).FirstOrDefault()); Assert.Equal("HH:mm:ss", Guesser.GuessFormat("21:22:23", Format.Moment).FirstOrDefault()); Assert.Equal("%H:%M:%S", Guesser.GuessFormat("21:22:23", Format.Linux).FirstOrDefault()); }
public void HoursAndMinsWithAbbreviatedTimezone24HourFormat() { Assert.Equal("HH:mm z", Guesser.GuessFormat("21:22 EST", Format.Java).FirstOrDefault()); Assert.Equal("HH:mm z", Guesser.GuessFormat("21:22 EST", Format.Moment).FirstOrDefault()); Assert.Equal("%H:%M %Z", Guesser.GuessFormat("21:22 EST", Format.Linux).FirstOrDefault()); }
public void InvalidDate12HourFormatam_pm() { Assert.Throws <Exception>(() => Guesser.GuessFormat("13:00 am", Format.Java)); Assert.Throws <Exception>(() => Guesser.GuessFormat("13:00 am", Format.Moment)); Assert.Throws <Exception>(() => Guesser.GuessFormat("13:00 am", Format.Linux)); }
public void HoursSingleDigitAndMinsCololSep24HourFormat() { Assert.Equal("H:mm", Guesser.GuessFormat("1:22", Format.Java).FirstOrDefault()); Assert.Equal("H:mm", Guesser.GuessFormat("1:22", Format.Moment).FirstOrDefault()); Assert.Equal("%-k:%M", Guesser.GuessFormat("1:22", Format.Linux).FirstOrDefault()); }
public void Mon_D_HH_mm_ss() { Assert.Equal("MMM d, HH:mm:ss", Guesser.GuessFormat("Jan 1, 10:00:59", Format.Java).FirstOrDefault()); Assert.Equal("MMM D, HH:mm:ss", Guesser.GuessFormat("Jan 1, 10:00:59", Format.Moment).FirstOrDefault()); Assert.Equal("%b %-e, %H:%M:%S", Guesser.GuessFormat("Jan 1, 10:00:59", Format.Linux).FirstOrDefault()); }
public void HoursAndMinsDotSep24HourFormat() { Assert.Equal("HH.mm", Guesser.GuessFormat("21.22", Format.Java).FirstOrDefault()); Assert.Equal("HH.mm", Guesser.GuessFormat("21.22", Format.Moment).FirstOrDefault()); Assert.Equal("%H.%M", Guesser.GuessFormat("21.22", Format.Linux).FirstOrDefault()); }
public void Mon_DD() { Assert.Equal("MMM dd", Guesser.GuessFormat("Jan 01", Format.Java).FirstOrDefault()); Assert.Equal("MMM DD", Guesser.GuessFormat("Jan 01", Format.Moment).FirstOrDefault()); Assert.Equal("%b %d", Guesser.GuessFormat("Jan 01", Format.Linux).FirstOrDefault()); }
public void HoursMinsAndSecsDotSep24HourFormat() { Assert.Equal("HH.mm.ss", Guesser.GuessFormat("21.22.23", Format.Java).FirstOrDefault()); Assert.Equal("HH.mm.ss", Guesser.GuessFormat("21.22.23", Format.Moment).FirstOrDefault()); Assert.Equal("%H.%M.%S", Guesser.GuessFormat("21.22.23", Format.Linux).FirstOrDefault()); }
public void ParseValidDayOfMonth() { Assert.Throws <Exception>(() => Guesser.GuessFormat("Jan 32", Format.Java)); Assert.Throws <Exception>(() => Guesser.GuessFormat("Jan 32", Format.Moment)); Assert.Throws <Exception>(() => Guesser.GuessFormat("Jan 32", Format.Linux)); }
public void CompleteTime24HourFormat() { Assert.Equal("HH:mm:ss.SSS Z", Guesser.GuessFormat("21:22:23.123 +0000", Format.Java).FirstOrDefault()); Assert.Equal("HH:mm:ss.SSS ZZ", Guesser.GuessFormat("21:22:23.123 +0000", Format.Moment).FirstOrDefault()); Assert.Equal("%H:%M:%S.%L %z", Guesser.GuessFormat("21:22:23.123 +0000", Format.Linux).FirstOrDefault()); }
public void DayOfMonthWithOrdinal() { Assert.Equal("MMM d'st'", Guesser.GuessFormat("Jan 1st", Format.Java).FirstOrDefault()); Assert.Equal("MMM Do", Guesser.GuessFormat("Jan 1st", Format.Moment).FirstOrDefault()); Assert.Equal("%b %o", Guesser.GuessFormat("Jan 1st", Format.Linux).FirstOrDefault()); }
public void HoursAndMinsColonSep12HourFormatAM_PM_Timezone() { Assert.Equal("hh:mm a z", Guesser.GuessFormat("10:00 AM GMT", Format.Java).FirstOrDefault()); Assert.Equal("hh:mm A z", Guesser.GuessFormat("10:00 AM GMT", Format.Moment).FirstOrDefault()); Assert.Equal("%I:%M %p %Z", Guesser.GuessFormat("10:00 AM GMT", Format.Linux).FirstOrDefault()); }
public void HoursMinsSecsColonSep12HourFormatam_pm() { Assert.Equal("hh:mm:ss a", Guesser.GuessFormat("10:00:59 am", Format.Java).FirstOrDefault()); Assert.Equal("hh:mm:ss a", Guesser.GuessFormat("10:00:59 am", Format.Moment).FirstOrDefault()); Assert.Equal("%I:%M:%S %P", Guesser.GuessFormat("10:00:59 am", Format.Linux).FirstOrDefault()); }