You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by fr...@apache.org on 2025/05/22 10:35:30 UTC
(logging-log4net) 01/01: added tests for #247
This is an automated email from the ASF dual-hosted git repository.
freeandnil pushed a commit to branch Feature/248-DateTimeFormattersFix
in repository https://gitbox.apache.org/repos/asf/logging-log4net.git
commit 6f9b7116993d6353e6587e579bc3d2f4269b97fe
Author: Jan Friedrich <fr...@apache.org>
AuthorDate: Thu May 22 12:35:06 2025 +0200
added tests for #247
---
.../DateFormatter/AbsoluteTimeDateFormatterTest.cs | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/log4net.Tests/DateFormatter/AbsoluteTimeDateFormatterTest.cs b/src/log4net.Tests/DateFormatter/AbsoluteTimeDateFormatterTest.cs
index ddc774e1..0a7aeb8a 100644
--- a/src/log4net.Tests/DateFormatter/AbsoluteTimeDateFormatterTest.cs
+++ b/src/log4net.Tests/DateFormatter/AbsoluteTimeDateFormatterTest.cs
@@ -99,6 +99,23 @@ public void TestFormattingResults()
Assert.That(sb.ToString(), Is.EqualTo("11:59:59,100"));
sb.Clear();
}
+
+ [Test]
+ public void FormatTwoPatternsTest()
+ {
+ AbsoluteTimeDateFormatter absolute = new();
+ Iso8601DateFormatter iso = new();
+ StringBuilder sb = new();
+ using StringWriter writer = new(sb, CultureInfo.InvariantCulture);
+
+ absolute.FormatDate(new DateTime(1970, 1, 1, 1, 1, 1).AddMilliseconds(1), writer);
+ Assert.That(sb.ToString(), Is.EqualTo("01:01:01,001"));
+ sb.Clear();
+
+ iso.FormatDate(new DateTime(1970, 1, 1, 1, 1, 1).AddMilliseconds(1), writer);
+ Assert.That(sb.ToString(), Is.EqualTo("1970-01-01 01:01:01,001"));
+ sb.Clear();
+ }
}
internal class FormatterOne : AbsoluteTimeDateFormatter