Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed LogManager GC test on Mono.

  • Loading branch information...
commit a4d93e3b8d13471c9525db7013dce4f907f82e45 1 parent 2777b71
Jarek Kowalski authored
Showing with 9 additions and 5 deletions.
  1. +9 −5 tests/NLog.UnitTests/LogManagerTests.cs
14 tests/NLog.UnitTests/LogManagerTests.cs
View
@@ -75,11 +75,16 @@ public void GarbageCollectionTest()
Assert.AreSame(loggerA1, loggerA2);
}
+ static WeakReference GetWeakReferenceToTemporaryLogger()
+ {
+ string uniqueLoggerName = Guid.NewGuid ().ToString();
+ return new WeakReference (LogManager.GetLogger(uniqueLoggerName));
+ }
+
[Test]
public void GarbageCollection2Test()
{
- string uniqueLoggerName = Guid.NewGuid().ToString();
- WeakReference wr = new WeakReference(LogManager.GetLogger(uniqueLoggerName));
+ WeakReference wr = GetWeakReferenceToTemporaryLogger();
// nobody's holding a reference to this Logger anymore, so GC.Collect(2) should free it
GC.Collect();
@@ -165,11 +170,10 @@ private void OnConfigReloaded(object sender, LoggingConfigurationReloadedEventAr
_reloadCounter++;
}
- private bool IsMacOsX()
+ private bool IsMacOsX ()
{
#if MONO
- // just an approximation, to detect Mac OS X
- if (Environment.OSVersion.Platform == PlatformID.Unix && Environment.OSVersion.Version.Major == 10)
+ if (Directory.Exists("/Library/Frameworks/Mono.framework/"))
{
return true;
}
Please sign in to comment.
Something went wrong with that request. Please try again.