Skip to content

Commit 3e982fa

Browse files
Additionnal adjustment.
1 parent 4ab216a commit 3e982fa

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

CoreMemoryCache/NHibernate.Caches.CoreMemoryCache.Tests/TestsContext.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
#if !NETFX
22
using NUnit.Framework;
33
using System.Configuration;
44
using System.IO;
@@ -13,9 +13,11 @@ namespace NHibernate.Caches.CoreMemoryCache.Tests
1313
[SetUpFixture]
1414
public class TestsContext
1515
{
16-
private static bool ExecutingWithVsTest { get; } =
16+
private static readonly bool ExecutingWithVsTest =
1717
Assembly.GetEntryAssembly()?.GetName().Name == "testhost";
1818

19+
private static bool _removeTesthostConfig;
20+
1921
[OneTimeSetUp]
2022
public void RunBeforeAnyTests()
2123
{
@@ -35,7 +37,7 @@ public void RunAfterAnyTests()
3537
{
3638
//When .NET Core App 2.0 tests run from VS/VSTest the entry assembly is "testhost.dll"
3739
//so we need to explicitly load the configuration
38-
if (ExecutingWithVsTest)
40+
if (_removeTesthostConfig)
3941
{
4042
File.Delete(GetTesthostConfigPath());
4143
}
@@ -52,6 +54,7 @@ private static void ReadCoreCacheSectionFromTesthostConfig()
5254
// or a previous test run was interupted before its cleanup (RunAfterAnyTests): go clean it manually.
5355
// Discussion about this mess: https://github.com/dotnet/corefx/issues/22101
5456
File.Copy(configPath, GetTesthostConfigPath());
57+
_removeTesthostConfig = true;
5558
ConfigurationManager.RefreshSection("corememorycache");
5659
}
5760

@@ -83,3 +86,4 @@ private static void ConfigureLog4Net()
8386
}
8487
}
8588
}
89+
#endif

0 commit comments

Comments
 (0)