@@ -16,15 +16,11 @@ public override string BugNumber
16
16
[ Test ]
17
17
public void ExceptionsInBeforeTransactionCompletionAbortTransaction ( )
18
18
{
19
- #pragma warning disable 618
20
- Assert . IsFalse ( sessions . Settings . IsInterceptorsBeforeTransactionCompletionIgnoreExceptionsEnabled ) ;
21
- #pragma warning restore 618
22
-
23
19
var c = new C { ID = 1 , Value = "value" } ;
24
20
25
21
var sessionInterceptor = new SessionInterceptorThatThrowsExceptionAtBeforeTransactionCompletion ( ) ;
26
- using ( ISession s = sessions . OpenSession ( sessionInterceptor ) )
27
- using ( ITransaction t = s . BeginTransaction ( ) )
22
+ using ( var s = sessions . WithOptions ( ) . Interceptor ( sessionInterceptor ) . OpenSession ( ) )
23
+ using ( var t = s . BeginTransaction ( ) )
28
24
{
29
25
s . Save ( c ) ;
30
26
@@ -42,10 +38,6 @@ public void ExceptionsInBeforeTransactionCompletionAbortTransaction()
42
38
[ Test ]
43
39
public void ExceptionsInSynchronizationBeforeTransactionCompletionAbortTransaction ( )
44
40
{
45
- #pragma warning disable 618
46
- Assert . IsFalse ( sessions . Settings . IsInterceptorsBeforeTransactionCompletionIgnoreExceptionsEnabled ) ;
47
- #pragma warning restore 618
48
-
49
41
var c = new C { ID = 1 , Value = "value" } ;
50
42
51
43
var synchronization = new SynchronizationThatThrowsExceptionAtBeforeTransactionCompletion ( ) ;
@@ -66,78 +58,4 @@ public void ExceptionsInSynchronizationBeforeTransactionCompletionAbortTransacti
66
58
}
67
59
}
68
60
}
69
-
70
-
71
- [ TestFixture ]
72
- [ Obsolete ( "Can be removed when Environment.InterceptorsBeforeTransactionCompletionIgnoreExceptions is removed." ) ]
73
- public class OldBehaviorEnabledFixture : BugTestCase
74
- {
75
- public override string BugNumber
76
- {
77
- get { return "NH1082" ; }
78
- }
79
-
80
- protected override void Configure ( Configuration configuration )
81
- {
82
- configuration . SetProperty ( Environment . InterceptorsBeforeTransactionCompletionIgnoreExceptions , "true" ) ;
83
- base . Configure ( configuration ) ;
84
- }
85
-
86
- [ Test ]
87
- public void ExceptionsInBeforeTransactionCompletionAreIgnored ( )
88
- {
89
- Assert . IsTrue ( sessions . Settings . IsInterceptorsBeforeTransactionCompletionIgnoreExceptionsEnabled ) ;
90
-
91
- var c = new C { ID = 1 , Value = "value" } ;
92
-
93
- var sessionInterceptor = new SessionInterceptorThatThrowsExceptionAtBeforeTransactionCompletion ( ) ;
94
- using ( ISession s = sessions . OpenSession ( sessionInterceptor ) )
95
- using ( ITransaction t = s . BeginTransaction ( ) )
96
- {
97
- s . Save ( c ) ;
98
-
99
- Assert . DoesNotThrow ( t . Commit ) ;
100
- }
101
-
102
- using ( ISession s = sessions . OpenSession ( ) )
103
- {
104
- var objectInDb = s . Get < C > ( 1 ) ;
105
-
106
- Assert . IsNotNull ( objectInDb ) ;
107
-
108
- s . Delete ( objectInDb ) ;
109
- s . Flush ( ) ;
110
- }
111
- }
112
-
113
-
114
- [ Test ]
115
- public void ExceptionsInSynchronizationBeforeTransactionCompletionAreIgnored ( )
116
- {
117
- Assert . IsTrue ( sessions . Settings . IsInterceptorsBeforeTransactionCompletionIgnoreExceptionsEnabled ) ;
118
-
119
- var c = new C { ID = 1 , Value = "value" } ;
120
-
121
- var synchronization = new SynchronizationThatThrowsExceptionAtBeforeTransactionCompletion ( ) ;
122
- using ( ISession s = sessions . OpenSession ( ) )
123
- using ( ITransaction t = s . BeginTransaction ( ) )
124
- {
125
- t . RegisterSynchronization ( synchronization ) ;
126
-
127
- s . Save ( c ) ;
128
-
129
- Assert . DoesNotThrow ( t . Commit ) ;
130
- }
131
-
132
- using ( ISession s = sessions . OpenSession ( ) )
133
- {
134
- var objectInDb = s . Get < C > ( 1 ) ;
135
-
136
- Assert . IsNotNull ( objectInDb ) ;
137
-
138
- s . Delete ( objectInDb ) ;
139
- s . Flush ( ) ;
140
- }
141
- }
142
- }
143
61
}
0 commit comments