-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c00e815
commit 3a08815
Showing
29 changed files
with
994 additions
and
384 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
src/Ephemerally.Redis.Xunit/EphemeralRedisDatabasePoolFixture.cs
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
src/Ephemerally.Redis.Xunit/EphemeralRedisMultiplexerFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using StackExchange.Redis; | ||
|
||
namespace Ephemerally.Redis.Xunit; | ||
|
||
public class EphemeralRedisMultiplexerFixture<TEphemeralRedisInstance>() | ||
: EphemeralRedisMultiplexerFixture(new TEphemeralRedisInstance()) | ||
where TEphemeralRedisInstance : IRedisInstanceFixture, new(); | ||
|
||
public class EphemeralRedisMultiplexerFixture : RedisMultiplexerFixture | ||
{ | ||
public EphemeralRedisMultiplexerFixture() { } | ||
protected EphemeralRedisMultiplexerFixture(IRedisInstanceFixture redisInstanceFixture) | ||
: base(redisInstanceFixture) { } | ||
|
||
protected override async Task<IConnectionMultiplexer> CreateMultiplexerAsync() | ||
{ | ||
var implementation = await base.CreateMultiplexerAsync(); | ||
return await CreateEphemeralMultiplexerAsync(implementation); | ||
} | ||
|
||
protected virtual Task<EphemeralConnectionMultiplexer> CreateEphemeralMultiplexerAsync(IConnectionMultiplexer implementation) => | ||
Task.FromResult(new EphemeralConnectionMultiplexer(implementation)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/Ephemerally.Redis.Xunit/PooledEphemeralRedisMultiplexerFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using StackExchange.Redis; | ||
|
||
namespace Ephemerally.Redis.Xunit; | ||
|
||
public class PooledEphemeralRedisMultiplexerFixture<TEphemeralRedisInstance>() | ||
: PooledEphemeralRedisMultiplexerFixture(new TEphemeralRedisInstance()) | ||
where TEphemeralRedisInstance : IRedisInstanceFixture, new(); | ||
|
||
public class PooledEphemeralRedisMultiplexerFixture : EphemeralRedisMultiplexerFixture | ||
{ | ||
public PooledEphemeralRedisMultiplexerFixture() { } | ||
protected PooledEphemeralRedisMultiplexerFixture(IRedisInstanceFixture redisInstanceFixture) | ||
: base(redisInstanceFixture) { } | ||
|
||
protected override async Task<IConnectionMultiplexer> CreateMultiplexerAsync() | ||
{ | ||
var implementation = await base.CreateMultiplexerAsync(); | ||
return await CreatePooledMultiplexerAsync(implementation); | ||
} | ||
|
||
protected virtual Task<PooledConnectionMultiplexer> CreatePooledMultiplexerAsync(IConnectionMultiplexer implementation) => | ||
Task.FromResult(new PooledConnectionMultiplexer(implementation)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Ephemerally.Redis.Xunit; | ||
using StackExchange.Redis; | ||
|
||
namespace Ephemerally; | ||
|
||
public static class PublicExtensions | ||
{ | ||
public static ConnectionMultiplexer GetMultiplexer(this IRedisInstanceFixture fixture) => | ||
ConnectionMultiplexer.Connect(fixture.ConnectionString); | ||
|
||
public static Task<ConnectionMultiplexer> GetMultiplexerAsync(this IRedisInstanceFixture fixture) => | ||
ConnectionMultiplexer.ConnectAsync(fixture.ConnectionString); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Xunit; | ||
|
||
namespace Ephemerally.Redis.Xunit; | ||
|
||
public interface IRedisInstance | ||
{ | ||
string ConnectionString { get; } | ||
} | ||
|
||
public interface IRedisInstanceFixture : IRedisInstance, IAsyncLifetime { } | ||
|
||
public sealed class UnmanagedDefaultLocalRedisInstanceFixture : IRedisInstanceFixture | ||
{ | ||
private static readonly Lazy<UnmanagedDefaultLocalRedisInstanceFixture> _instance = new(() => new UnmanagedDefaultLocalRedisInstanceFixture()); | ||
|
||
public static UnmanagedDefaultLocalRedisInstanceFixture DefaultLocalRedisInstanceFixture => _instance.Value; | ||
|
||
private UnmanagedDefaultLocalRedisInstanceFixture() { } | ||
|
||
public string ConnectionString => DefaultLocalRedisInstance.ConnectionString; | ||
public Task InitializeAsync() => Task.CompletedTask; | ||
|
||
public Task DisposeAsync() => Task.CompletedTask; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.