File tree Expand file tree Collapse file tree 2 files changed +16
-21
lines changed
test/WorkflowCore.Tests.Redis Expand file tree Collapse file tree 2 files changed +16
-21
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
- using Docker . Testify ;
3
- using StackExchange . Redis ;
2
+ using System . Threading . Tasks ;
3
+ using Squadron ;
4
4
using Xunit ;
5
5
6
6
namespace WorkflowCore . Tests . Redis
7
7
{
8
- public class RedisDockerSetup : DockerSetup
8
+ public class RedisDockerSetup : IAsyncLifetime
9
9
{
10
+ private readonly RedisResource _redisResource ;
10
11
public static string ConnectionString { get ; set ; }
11
12
12
- public override string ImageName => @"redis" ;
13
- public override int InternalPort => 6379 ;
14
-
15
- public override void PublishConnectionInfo ( )
13
+ public RedisDockerSetup ( )
16
14
{
17
- ConnectionString = $ "localhost: { ExternalPort } " ;
15
+ _redisResource = new RedisResource ( ) ;
18
16
}
19
17
20
- public override bool TestReady ( )
18
+ public async Task InitializeAsync ( )
21
19
{
22
- try
23
- {
24
- var multiplexer = ConnectionMultiplexer . Connect ( $ "localhost:{ ExternalPort } ") ;
25
- return multiplexer . IsConnected ;
26
- }
27
- catch
28
- {
29
- return false ;
30
- }
20
+ await _redisResource . InitializeAsync ( ) ;
21
+ ConnectionString = _redisResource . ConnectionString ;
22
+ }
31
23
24
+ public Task DisposeAsync ( )
25
+ {
26
+ return _redisResource . DisposeAsync ( ) ;
32
27
}
33
28
}
34
29
35
30
[ CollectionDefinition ( "Redis collection" ) ]
36
31
public class RedisCollection : ICollectionFixture < RedisDockerSetup >
37
32
{
38
33
}
39
-
40
34
}
Original file line number Diff line number Diff line change 3
3
<ItemGroup >
4
4
<PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 15.9.0" />
5
5
<PackageReference Include =" StackExchange.Redis" Version =" 2.0.601" />
6
- <PackageReference Include =" xunit" Version =" 2.4.0" />
7
- <PackageReference Include =" xunit.runner.visualstudio" Version =" 2.4.0" />
6
+ <PackageReference Include =" xunit" Version =" 2.4.1" />
7
+ <PackageReference Include =" xunit.runner.visualstudio" Version =" 2.4.1" />
8
+ <PackageReference Include =" Squadron.Redis" Version =" 0.17.0" />
8
9
</ItemGroup >
9
10
10
11
<ItemGroup >
You can’t perform that action at this time.
0 commit comments