Skip to content

Commit 5265b1e

Browse files
committed
NH-3900 - Reset PrivateBinPath when done with test.
1 parent ccd288c commit 5265b1e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/NHibernate.Test/NHSpecificTest/NH2188/AppDomainWithMultipleSearchPath.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,19 @@ public string DefaultConfigurationFilePath()
1414
return GetDefaultConfigurationFilePath();
1515
}
1616
}
17+
1718
[Test]
1819
public void WhenSerchInMultiplePathsThenNotThrows()
1920
{
21+
// NUnit 3 sets PrivateBinPath when using an NUnit project, so we need to reset back to the correct setting when done.
22+
var privatePath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;
23+
2024
string binPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin");
2125
var expected = Path.Combine(binPath, Configuration.DefaultHibernateCfgFileName);
2226

2327
try
2428
{
29+
AppDomain.CurrentDomain.ClearPrivatePath();
2530
AppDomain.CurrentDomain.AppendPrivatePath("bin");
2631
AppDomain.CurrentDomain.AppendPrivatePath("DbScripts");
2732
var configuration = new MyNhConfiguration();
@@ -30,7 +35,8 @@ public void WhenSerchInMultiplePathsThenNotThrows()
3035
finally
3136
{
3237
AppDomain.CurrentDomain.ClearPrivatePath();
38+
if (privatePath != null) AppDomain.CurrentDomain.AppendPrivatePath(privatePath);
3339
}
3440
}
3541
}
36-
}
42+
}

0 commit comments

Comments
 (0)