This is an automated email from the ASF dual-hosted git repository.
freeandnil pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4net.git
The following commit(s) were added to refs/heads/master by this push:
new f3aef052 #227 cleanup SystemInfo.EntryAssemblyLocation in test
f3aef052 is described below
commit f3aef052a2263f784794f8ebbd7432566a8847dc
Author: Jan Friedrich <[email protected]>
AuthorDate: Fri Feb 7 15:19:50 2025 +0100
#227 cleanup SystemInfo.EntryAssemblyLocation in test
---
src/log4net.Tests/Config/XmlConfiguratorTest.cs | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/log4net.Tests/Config/XmlConfiguratorTest.cs
b/src/log4net.Tests/Config/XmlConfiguratorTest.cs
index aabf3fb4..4c6dfd37 100644
--- a/src/log4net.Tests/Config/XmlConfiguratorTest.cs
+++ b/src/log4net.Tests/Config/XmlConfiguratorTest.cs
@@ -44,17 +44,22 @@ public void ConfigureWithUnkownConfigFile()
Func<XmlElement?> getConfigSection = () => null;
ILoggerRepository repository =
LogManager.CreateRepository(Guid.NewGuid().ToString());
SystemInfo.EntryAssemblyLocation = Guid.NewGuid().ToString();
- List<LogLog> configurationMessages = [];
-
- using (new LogLog.LogReceivedAdapter(configurationMessages))
+ try
{
+ List<LogLog> configurationMessages = [];
+
+ using LogLog.LogReceivedAdapter _ = new(configurationMessages);
typeof(XmlConfigurator)
.GetMethod("InternalConfigure", BindingFlags.NonPublic |
BindingFlags.Static, [typeof(ILoggerRepository), getConfigSection.GetType()])!
.Invoke(null, [repository, getConfigSection]);
- }
- Assert.That(configurationMessages, Has.Count.EqualTo(1));
- Assert.That(configurationMessages[0].Message,
Contains.Substring(SystemInfo.EntryAssemblyLocation + ".config"));
+ Assert.That(configurationMessages, Has.Count.EqualTo(1));
+ Assert.That(configurationMessages[0].Message,
Contains.Substring(SystemInfo.EntryAssemblyLocation + ".config"));
+ }
+ finally
+ {
+ SystemInfo.EntryAssemblyLocation = null!;
+ }
}
}
#endif
\ No newline at end of file