File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed
test/Serilog.Sinks.MSSqlServer.Tests/Sinks/MSSqlServer Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
- using System . Data ;
4
3
using Moq ;
5
4
using Serilog . Events ;
6
5
using Serilog . Parsing ;
@@ -157,6 +156,16 @@ public void EmitCallsSqlLogEventWriter()
157
156
_sqlLogEventWriter . Verify ( w => w . WriteEvent ( logEvent ) , Times . Once ) ;
158
157
}
159
158
159
+ [ Fact ]
160
+ public void OnDisposeDisposesSqlLogEventWriterDependency ( )
161
+ {
162
+ // Arrange + act
163
+ using ( new MSSqlServerAuditSink ( _sinkOptions , _columnOptions , _sinkDependencies ) ) { }
164
+
165
+ // Assert
166
+ _sqlLogEventWriter . Verify ( w => w . Dispose ( ) , Times . Once ) ;
167
+ }
168
+
160
169
private void SetupSut ( bool autoCreateSqlDatabase = false , bool autoCreateSqlTable = false )
161
170
{
162
171
_sinkOptions . AutoCreateSqlDatabase = autoCreateSqlDatabase ;
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
- using System . Data ;
4
3
using System . Threading . Tasks ;
5
4
using Moq ;
6
5
using Serilog . Events ;
@@ -185,6 +184,26 @@ public void OnEmptyBatchAsyncReturnsCompletedTask()
185
184
Assert . True ( task . IsCompleted ) ;
186
185
}
187
186
187
+ [ Fact ]
188
+ public void OnDisposeDisposesSqlBulkBatchWriterDependency ( )
189
+ {
190
+ // Arrange + act
191
+ using ( new MSSqlServerSink ( _sinkOptions , _sinkDependencies ) ) { }
192
+
193
+ // Assert
194
+ _sqlBulkBatchWriter . Verify ( w => w . Dispose ( ) , Times . Once ) ;
195
+ }
196
+
197
+ [ Fact ]
198
+ public void OnDisposeDisposesSqlLogEventWriterDependency ( )
199
+ {
200
+ // Arrange + act
201
+ using ( new MSSqlServerSink ( _sinkOptions , _sinkDependencies ) ) { }
202
+
203
+ // Assert
204
+ _sqlLogEventWriter . Verify ( w => w . Dispose ( ) , Times . Once ) ;
205
+ }
206
+
188
207
private void SetupSut (
189
208
bool autoCreateSqlDatabase = false ,
190
209
bool autoCreateSqlTable = false ,
You can’t perform that action at this time.
0 commit comments