RedisConnectionFixture.cs 823 B

1234567891011121314151617181920212223242526
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. using StackExchange.Redis;
  4. namespace Microsoft.AspNetCore.OutputCaching.StackExchangeRedis.Tests;
  5. public class RedisConnectionFixture : IDisposable
  6. {
  7. private readonly ConnectionMultiplexer _muxer;
  8. public RedisConnectionFixture()
  9. {
  10. var options = new RedisOutputCacheOptions
  11. {
  12. Configuration = "127.0.0.1:6379", // TODO: CI test config here
  13. }.GetConfiguredOptions();
  14. _muxer = ConnectionMultiplexer.Connect(options);
  15. _muxer.AddLibraryNameSuffix("test");
  16. }
  17. public IDatabase Database => _muxer.GetDatabase();
  18. public IConnectionMultiplexer Connection => _muxer;
  19. public void Dispose() => _muxer.Dispose();
  20. }