File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change 1
1
#if NETCOREAPP2_0
2
-
3
2
using NUnit . Framework ;
4
3
using System . Configuration ;
5
- using System . IO ;
6
4
using NHibernate . Cfg ;
7
5
8
6
namespace NHibernate . Test
9
7
{
10
8
[ SetUpFixture ]
11
9
public class TestsContext
12
10
{
13
- private static bool ExecutingWithVsTest { get ; } =
14
- System . Reflection . Assembly . GetEntryAssembly ( ) ? . GetName ( ) . Name == "testhost" ;
15
-
16
11
[ OneTimeSetUp ]
17
12
public void RunBeforeAnyTests ( )
18
13
{
19
14
//When .NET Core App 2.0 tests run from VS/VSTest the entry assembly is "testhost.dll"
20
15
//so we need to explicitly load the configuration
21
- if ( ExecutingWithVsTest )
16
+ if ( System . Reflection . Assembly . GetEntryAssembly ( ) != null )
22
17
{
23
- var assemblyPath = Path . Combine ( TestContext . CurrentContext . TestDirectory , Path . GetFileName ( typeof ( TestsContext ) . Assembly . Location ) ) ;
24
- ConfigurationProvider . Current = new SystemConfigurationProvider ( ConfigurationManager . OpenExeConfiguration ( assemblyPath ) ) ;
18
+ ConfigurationProvider . Current = new SystemConfigurationProvider ( ConfigurationManager . OpenExeConfiguration ( typeof ( TestsContext ) . Assembly . Location ) ) ;
25
19
}
26
20
}
27
21
}
You can’t perform that action at this time.
0 commit comments