@@ -198,53 +198,42 @@ public void WriteEventCallsLogEventDataGeneratorGetColumnsAndValuesWithLogEvent(
198
198
}
199
199
200
200
[ Fact ]
201
- public void WriteEventWritesSelfLogAndRethrowsIfSqlConnectionFactoryCreateThrows ( )
201
+ public void WriteEventRethrowsIfSqlConnectionFactoryCreateThrows ( )
202
202
{
203
203
// Arrange
204
- var selfLogWritten = false ;
205
- SelfLog . Enable ( w => selfLogWritten = true ) ;
206
204
_sqlConnectionFactoryMock . Setup ( f => f . Create ( ) ) . Callback ( ( ) => throw new Exception ( ) ) ;
207
205
var logEvent = TestLogEventHelper . CreateLogEvent ( ) ;
208
206
209
207
// Act + assert
210
208
Assert . Throws < Exception > ( ( ) => _sut . WriteEvent ( logEvent ) ) ;
211
- Assert . True ( selfLogWritten ) ;
212
209
}
213
210
214
211
[ Fact ]
215
- public void WriteEventWritesSelfLogAndRethrowsIfSqlConnectionCreateCommandThrows ( )
212
+ public void WriteEventRethrowsIfSqlConnectionCreateCommandThrows ( )
216
213
{
217
214
// Arrange
218
- var selfLogWritten = false ;
219
- SelfLog . Enable ( w => selfLogWritten = true ) ;
220
215
_sqlConnectionWrapperMock . Setup ( c => c . CreateCommand ( ) ) . Callback ( ( ) => throw new Exception ( ) ) ;
221
216
var logEvent = TestLogEventHelper . CreateLogEvent ( ) ;
222
217
223
218
// Act + assert
224
219
Assert . Throws < Exception > ( ( ) => _sut . WriteEvent ( logEvent ) ) ;
225
- Assert . True ( selfLogWritten ) ;
226
220
}
227
221
228
222
[ Fact ]
229
- public void WriteEventWritesSelfLogAndRethrowsIfLogEventDataGeneratorGetColumnsAndValuesThrows ( )
223
+ public void WriteEventRethrowsIfLogEventDataGeneratorGetColumnsAndValuesThrows ( )
230
224
{
231
225
// Arrange
232
- var selfLogWritten = false ;
233
- SelfLog . Enable ( w => selfLogWritten = true ) ;
234
226
_logEventDataGeneratorMock . Setup ( d => d . GetColumnsAndValues ( It . IsAny < LogEvent > ( ) ) ) . Callback ( ( ) => throw new Exception ( ) ) ;
235
227
var logEvent = TestLogEventHelper . CreateLogEvent ( ) ;
236
228
237
229
// Act + assert
238
230
Assert . Throws < Exception > ( ( ) => _sut . WriteEvent ( logEvent ) ) ;
239
- Assert . True ( selfLogWritten ) ;
240
231
}
241
232
242
233
[ Fact ]
243
- public void WriteEventWritesSelfLogAndRethrowsIfSqlCommandAddParameterThrows ( )
234
+ public void WriteEventRethrowsIfSqlCommandAddParameterThrows ( )
244
235
{
245
236
// Arrange
246
- var selfLogWritten = false ;
247
- SelfLog . Enable ( w => selfLogWritten = true ) ;
248
237
_sqlCommandWrapperMock . Setup ( c => c . AddParameter ( It . IsAny < string > ( ) , It . IsAny < object > ( ) ) ) . Callback ( ( ) => throw new Exception ( ) ) ;
249
238
var fieldsAndValues = new List < KeyValuePair < string , object > > { new KeyValuePair < string , object > ( "FieldName1" , "FieldValue1" ) } ;
250
239
_logEventDataGeneratorMock . Setup ( d => d . GetColumnsAndValues ( It . IsAny < LogEvent > ( ) ) )
@@ -253,21 +242,17 @@ public void WriteEventWritesSelfLogAndRethrowsIfSqlCommandAddParameterThrows()
253
242
254
243
// Act + assert
255
244
Assert . Throws < Exception > ( ( ) => _sut . WriteEvent ( logEvent ) ) ;
256
- Assert . True ( selfLogWritten ) ;
257
245
}
258
246
259
247
[ Fact ]
260
- public void WriteEventWritesSelfLogAndRethrowsIfSqlCommandExecuteNonQueryThrows ( )
248
+ public void WriteEventRethrowsIfSqlCommandExecuteNonQueryThrows ( )
261
249
{
262
250
// Arrange
263
- var selfLogWritten = false ;
264
- SelfLog . Enable ( w => selfLogWritten = true ) ;
265
251
_sqlCommandWrapperMock . Setup ( c => c . ExecuteNonQuery ( ) ) . Callback ( ( ) => throw new Exception ( ) ) ;
266
252
var logEvent = TestLogEventHelper . CreateLogEvent ( ) ;
267
253
268
254
// Act + assert
269
255
Assert . Throws < Exception > ( ( ) => _sut . WriteEvent ( logEvent ) ) ;
270
- Assert . True ( selfLogWritten ) ;
271
256
}
272
257
}
273
258
}
0 commit comments