File tree Expand file tree Collapse file tree 3 files changed +34
-23
lines changed
Expand file tree Collapse file tree 3 files changed +34
-23
lines changed Original file line number Diff line number Diff line change 1212namespace NHibernate . Test . Linq
1313{
1414 [ SetUpFixture ]
15- public class LinqReadonlyTestsContext
15+ public class LinqReadonlyTestsContext : TestsContextBase
1616 {
1717 /// <summary>
1818 /// Assembly to load mapping files from
Original file line number Diff line number Diff line change 11using NUnit . Framework ;
2- using System . Configuration ;
3- using System . Reflection ;
4- using log4net ;
5- using log4net . Config ;
6- using NHibernate . Cfg ;
72
83namespace NHibernate . Test
94{
105 [ SetUpFixture ]
11- public class TestsContext
6+ public class TestsContext : TestsContextBase
127 {
13- private static readonly Assembly TestAssembly = typeof ( TestsContext ) . Assembly ;
14-
158 [ OneTimeSetUp ]
169 public void RunBeforeAnyTests ( )
1710 {
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
3212 }
3313 }
3414}
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