Skip to content

Commit

Permalink
#229 fix test for other time zones
Browse files Browse the repository at this point in the history
  • Loading branch information
FreeAndNil committed Feb 10, 2025
1 parent f159984 commit d605808
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/log4net.Tests/Layout/PatternLayoutTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,20 +345,20 @@ public void TestExceptionPattern()
}
#if NET8_0_OR_GREATER
[Test]
public void ConvertMicroSecondsPatternTest()
public void ConvertMicrosecondsPatternTest()
{
StringAppender stringAppender = new()
{
Layout = NewPatternLayout("%date{yyyyMMdd HH:mm:ss.ffffff}")
Layout = NewPatternLayout("%utcdate{yyyyMMdd HH:mm:ss.ffffff}")
};

ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
BasicConfigurator.Configure(rep, stringAppender);

ILog logger = LogManager.GetLogger(rep.Name, "TestThreadProperiesPattern");

logger.Logger.Log(new(new() { TimeStampUtc = new(2025, 02, 10, 13, 01, 02, 123, 456), Message = "test", Level = Level.Info }));
Assert.That(stringAppender.GetString(), Is.EqualTo("20250210 14:01:02.123456"));
logger.Logger.Log(new(new() { TimeStampUtc = new(2025, 02, 10, 13, 01, 02, 123, 456, DateTimeKind.Utc), Message = "test", Level = Level.Info }));
Assert.That(stringAppender.GetString(), Is.EqualTo("20250210 13:01:02.123456"));
}
#endif

Expand Down

0 comments on commit d605808

Please sign in to comment.