[DataRow("en-GB", "2019-07-01T17:42:32.123+0800", true, "2019-07-01 17:42:32.123 +0800")] // Local timezone specified public void TryParse_Behaves_Correctly(string culture, string text, bool expectedResult, string expectedValueText) { using (new CultureSwap(culture)) { var parser = new DateTimeOffset_Invariant_Parser(); var actualResult = parser.TryParse(text, out var actualValue); var expectedValue = DataRowParser.DateTimeOffset(expectedValueText); Assert.AreEqual(expectedResult, actualResult); Assert.AreEqual(expectedValue, actualValue); } }
public void GetAugmentedParsers_Augments_Registered_Parsers_With_List_Passed_In() { var originalDateTimeParser = new DateTime_Local_Parser(); var originalDateTimeOffsetParser = new DateTimeOffset_Invariant_Parser(); var newDateTimeParser = new DateTime_Iso8601_Parser(); var newByteArrayParser = new ByteArray_Mime64_Parser(); var resolver = new TypeParserResolver(originalDateTimeParser, originalDateTimeOffsetParser); var parsers = resolver.GetAugmentedParsers(newDateTimeParser, null, newByteArrayParser); Assert.AreEqual(3, parsers.Length); Assert.IsTrue(parsers.Contains(newDateTimeParser)); Assert.IsTrue(parsers.Contains(originalDateTimeOffsetParser)); Assert.IsTrue(parsers.Contains(newByteArrayParser)); var originalParsers = resolver.GetParsers(); Assert.AreEqual(2, originalParsers.Length); Assert.IsTrue(originalParsers.Contains(originalDateTimeParser)); Assert.IsTrue(originalParsers.Contains(originalDateTimeOffsetParser)); }