public void Format_Roundtrip(string input) { var parsed = Timestamps.Parse(input); var formatted = Timestamps.Format(parsed); Assert.Equal(input, formatted); }
public void Format_NonRoundtrip(string input, string expectedFormatted) { var parsed = Timestamps.Parse(input); var formatted = Timestamps.Format(parsed); Assert.Equal(expectedFormatted, formatted); }
static void AssertParseSuccess(DateTimeOffset expected, string text) { var parsed = Timestamps.Parse(text); AssertTimestampsEqual(expected, parsed); Assert.True(Timestamps.TryParse(text, out parsed)); AssertTimestampsEqual(expected, parsed); }
[InlineData("2021-01-01T00:01Z")] // No second part public void Parse_Failure(string text) { Assert.False(Timestamps.TryParse(text, out _)); Assert.Throws <FormatException>(() => Timestamps.Parse(text)); }