public void ParseYears(int year, int month, int day, int hour, int minute, int second, int milliseconds = 0) { var date = new DateTime(year, month, day, hour, minute, second, milliseconds); var datetimeOffset = new DateTimeOffset(date, TimeSpan.Zero); Assert.AreEqual(datetimeOffset, DateTimeOffsetFieldParser.Parse(date.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"))); }
public static IEnumerable <Test> ParseYears() { return(parsedDates.Select(pd => { var name = "ParseYears " + pd.Key; Test t = new TestCase(name, () => Assert.AreEqual(pd.Value, DateTimeOffsetFieldParser.Parse(pd.Key))); return t; })); }
public void RoundTripUtcDateTime(int year, int month, int day, int hour, int minute, int second, int milliseconds = 0) { var date = new DateTime(year, month, day, hour, minute, second, milliseconds, DateTimeKind.Utc); var dateTimeOffset = new DateTimeOffset(date); var value = DateTimeOffsetFieldParser.Parse(DateTimeOffsetFieldSerializer.Serialize(dateTimeOffset)); Assert.AreEqual(dateTimeOffset, value); }
public static IEnumerable <Test> RoundTrip() { return(dateTimes.Select(dt => { Test t = new TestCase("RoundTrip " + dt, () => { var value = DateTimeOffsetFieldParser.Parse(DateTimeOffsetFieldSerializer.Serialize(dt)); Assert.AreEqual(dt, value); }); return t; })); }
public void RoundTrip(DateTimeOffset dt) { var value = DateTimeOffsetFieldParser.Parse(DateTimeOffsetFieldSerializer.Serialize(dt)); Assert.AreEqual(dt, value); }
public static void ParseYearsTest(KeyValuePair <string, DateTimeOffset> pd) { Assert.AreEqual(pd.Value, DateTimeOffsetFieldParser.Parse(pd.Key)); }
public static void ParseYears(KeyValuePair <string, DateTimeOffset> pd) { var name = "ParseYears " + pd.Key; Assert.Equal(pd.Value, DateTimeOffsetFieldParser.Parse(pd.Key)); }