File tree 1 file changed +7
-9
lines changed
tests/Confluent.Kafka.1.1.0.Tests
1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 1
- using System . Threading . Tasks ;
1
+ using System ;
2
+ using System . Threading . Tasks ;
2
3
using Log . It ;
3
4
using Log . It . With . NLog ;
4
5
using Microsoft . Extensions . Configuration ;
@@ -10,6 +11,8 @@ namespace Kafka.TestFramework.Tests
10
11
{
11
12
public class TestSpecificationAsync : XUnit2SpecificationAsync
12
13
{
14
+ private readonly IDisposable _logWriter ;
15
+
13
16
static TestSpecificationAsync ( )
14
17
{
15
18
var config = new ConfigurationBuilder ( )
@@ -19,23 +22,18 @@ static TestSpecificationAsync()
19
22
20
23
NLog . LogManager . Configuration = new NLogLoggingConfiguration ( config . GetSection ( "NLog" ) ) ;
21
24
LogFactory . Initialize ( new NLogFactory ( new LogicalThreadContext ( ) ) ) ;
25
+ NLogCapturingTarget . Subscribe += Output . Writer . WriteLine ;
22
26
}
23
27
24
28
public TestSpecificationAsync ( ITestOutputHelper testOutputHelper ) : base ( testOutputHelper )
25
29
{
26
- NLogCapturingTarget . Subscribe += TestOutputHelper . WriteLine ;
27
- }
28
-
29
- protected virtual Task TearDownAsync ( )
30
- {
31
- return Task . CompletedTask ;
30
+ _logWriter = Output . WriteTo ( testOutputHelper ) ;
32
31
}
33
32
34
33
protected sealed override async Task DisposeAsync ( bool disposing )
35
34
{
36
- NLogCapturingTarget . Subscribe -= TestOutputHelper . WriteLine ;
37
- await TearDownAsync ( ) ;
38
35
await base . DisposeAsync ( disposing ) ;
36
+ _logWriter . Dispose ( ) ;
39
37
}
40
38
}
41
39
}
You can’t perform that action at this time.
0 commit comments