Example #1
0
        public void Format_Roundtrip(string input)
        {
            var parsed    = Timestamps.Parse(input);
            var formatted = Timestamps.Format(parsed);

            Assert.Equal(input, formatted);
        }
Example #2
0
        public void Format_NonRoundtrip(string input, string expectedFormatted)
        {
            var parsed    = Timestamps.Parse(input);
            var formatted = Timestamps.Format(parsed);

            Assert.Equal(expectedFormatted, formatted);
        }
Example #3
0
        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);
        }
Example #4
0
 [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));
 }