File tree 3 files changed +34
-23
lines changed
3 files changed +34
-23
lines changed Original file line number Diff line number Diff line change 12
12
namespace NHibernate . Test . Linq
13
13
{
14
14
[ SetUpFixture ]
15
- public class LinqReadonlyTestsContext
15
+ public class LinqReadonlyTestsContext : TestsContextBase
16
16
{
17
17
/// <summary>
18
18
/// Assembly to load mapping files from
Original file line number Diff line number Diff line change 1
1
using NUnit . Framework ;
2
- using System . Configuration ;
3
- using System . Reflection ;
4
- using log4net ;
5
- using log4net . Config ;
6
- using NHibernate . Cfg ;
7
2
8
3
namespace NHibernate . Test
9
4
{
10
5
[ SetUpFixture ]
11
- public class TestsContext
6
+ public class TestsContext : TestsContextBase
12
7
{
13
- private static readonly Assembly TestAssembly = typeof ( TestsContext ) . Assembly ;
14
-
15
8
[ OneTimeSetUp ]
16
9
public void RunBeforeAnyTests ( )
17
10
{
18
- ConfigureLog4Net ( ) ;
19
-
20
- //When .NET Core App 2.0 tests run from VS/VSTest the entry assembly is "testhost.dll"
21
- //so we need to explicitly load the configuration
22
- if ( Assembly . GetEntryAssembly ( ) != null )
23
- {
24
- ConfigurationProvider . Current = new SystemConfigurationProvider ( ConfigurationManager . OpenExeConfiguration ( TestAssembly . Location ) ) ;
25
- }
26
- }
27
-
28
- private static void ConfigureLog4Net ( )
29
- {
30
- using ( var log4NetXml = TestAssembly . GetManifestResourceStream ( "NHibernate.Test.log4net.xml" ) )
31
- XmlConfigurator . Configure ( LogManager . GetRepository ( TestAssembly ) , log4NetXml ) ;
11
+ //Everything is done in TestsContextBase static ctor
32
12
}
33
13
}
34
14
}
Original file line number Diff line number Diff line change
1
+ using System . Configuration ;
2
+ using System . Reflection ;
3
+ using log4net ;
4
+ using log4net . Config ;
5
+ using NHibernate . Cfg ;
6
+
7
+ namespace NHibernate . Test
8
+ {
9
+ public abstract class TestsContextBase
10
+ {
11
+ private static readonly Assembly TestAssembly = typeof ( TestsContextBase ) . Assembly ;
12
+
13
+ static TestsContextBase ( )
14
+ {
15
+ ConfigureLog4Net ( ) ;
16
+
17
+ //When .NET Core App 2.0 tests run from VS/VSTest the entry assembly is "testhost.dll"
18
+ //so we need to explicitly load the configuration
19
+ if ( Assembly . GetEntryAssembly ( ) != null )
20
+ {
21
+ ConfigurationProvider . Current = new SystemConfigurationProvider ( ConfigurationManager . OpenExeConfiguration ( TestAssembly . Location ) ) ;
22
+ }
23
+ }
24
+
25
+ private static void ConfigureLog4Net ( )
26
+ {
27
+ using ( var log4NetXml = TestAssembly . GetManifestResourceStream ( "NHibernate.Test.log4net.xml" ) )
28
+ XmlConfigurator . Configure ( LogManager . GetRepository ( TestAssembly ) , log4NetXml ) ;
29
+ }
30
+ }
31
+ }
You can’t perform that action at this time.
0 commit comments