File tree Expand file tree Collapse file tree 3 files changed +28
-34
lines changed
Async/NHSpecificTest/LoadingNullEntityInSet
NHSpecificTest/LoadingNullEntityInSet Expand file tree Collapse file tree 3 files changed +28
-34
lines changed Original file line number Diff line number Diff line change @@ -38,16 +38,15 @@ protected override DebugSessionFactory BuildSessionFactory()
38
38
. CollectionTable . Name = "WantedProfessions" ;
39
39
cfg . GetCollectionMapping ( typeof ( Employee ) . FullName + ".Secondaries" )
40
40
. CollectionTable . Name = "WantedProfessions" ;
41
- return base . BuildSessionFactory ( ) ;
42
- }
43
-
44
- protected override void OnTearDown ( )
45
- {
46
- cfg . GetCollectionMapping ( typeof ( Employee ) . FullName + ".Primaries" )
47
- . CollectionTable . Name = "WantedProfessions_DUMMY_1" ;
48
- cfg . GetCollectionMapping ( typeof ( Employee ) . FullName + ".Secondaries" )
49
- . CollectionTable . Name = "WantedProfessions_DUMMY_2" ;
50
- base . OnTearDown ( ) ;
41
+ try
42
+ {
43
+ return base . BuildSessionFactory ( ) ;
44
+ }
45
+ finally
46
+ {
47
+ // Restore configuration.
48
+ Configure ( ) ;
49
+ }
51
50
}
52
51
53
52
[ Test ]
Original file line number Diff line number Diff line change @@ -27,16 +27,15 @@ protected override DebugSessionFactory BuildSessionFactory()
27
27
. CollectionTable . Name = "WantedProfessions" ;
28
28
cfg . GetCollectionMapping ( typeof ( Employee ) . FullName + ".Secondaries" )
29
29
. CollectionTable . Name = "WantedProfessions" ;
30
- return base . BuildSessionFactory ( ) ;
31
- }
32
-
33
- protected override void OnTearDown ( )
34
- {
35
- cfg . GetCollectionMapping ( typeof ( Employee ) . FullName + ".Primaries" )
36
- . CollectionTable . Name = "WantedProfessions_DUMMY_1" ;
37
- cfg . GetCollectionMapping ( typeof ( Employee ) . FullName + ".Secondaries" )
38
- . CollectionTable . Name = "WantedProfessions_DUMMY_2" ;
39
- base . OnTearDown ( ) ;
30
+ try
31
+ {
32
+ return base . BuildSessionFactory ( ) ;
33
+ }
34
+ finally
35
+ {
36
+ // Restore configuration.
37
+ Configure ( ) ;
38
+ }
40
39
}
41
40
42
41
[ Test ]
Original file line number Diff line number Diff line change @@ -68,20 +68,12 @@ public void TestFixtureSetUp()
68
68
Assert . Ignore ( GetType ( ) + " does not apply to " + Dialect ) ;
69
69
}
70
70
71
- CreateSchema ( ) ;
72
- try
71
+ _sessionFactory = BuildSessionFactory ( ) ;
72
+ if ( ! AppliesTo ( _sessionFactory ) )
73
73
{
74
- _sessionFactory = BuildSessionFactory ( ) ;
75
- if ( ! AppliesTo ( _sessionFactory ) )
76
- {
77
- Assert . Ignore ( GetType ( ) + " does not apply with the current session-factory configuration" ) ;
78
- }
79
- }
80
- catch
81
- {
82
- DropSchema ( ) ;
83
- throw ;
74
+ Assert . Ignore ( GetType ( ) + " does not apply with the current session-factory configuration" ) ;
84
75
}
76
+ CreateSchema ( ) ;
85
77
}
86
78
catch ( Exception e )
87
79
{
@@ -116,7 +108,8 @@ public void TestFixtureTearDown()
116
108
if ( ! AppliesTo ( Dialect ) )
117
109
return ;
118
110
119
- DropSchema ( ) ;
111
+ if ( AppliesTo ( _sessionFactory ) )
112
+ DropSchema ( ) ;
120
113
Cleanup ( ) ;
121
114
}
122
115
}
@@ -261,7 +254,10 @@ private bool CheckConnectionsWereClosed()
261
254
return false ;
262
255
}
263
256
264
- private void Configure ( )
257
+ /// <summary>
258
+ /// (Re)Create the configuration.
259
+ /// </summary>
260
+ protected void Configure ( )
265
261
{
266
262
cfg = TestConfigurationHelper . GetDefaultConfiguration ( ) ;
267
263
You can’t perform that action at this time.
0 commit comments