Squadron

Squadron

  • Docs
  • Blog
  • GitHub

›Container Providers

Introduction

  • Introduction
  • Quickstart
  • Basic Concept
  • Container Options
  • Configuration
  • Multiple resources

Container Providers

  • MongoDB
  • MongoDB Replica Set
  • SQL Server
  • Elasticsearch
  • PostgreSQL
  • Redis
  • RabbitMQ
  • Azure Storage
  • Generic
  • Compose

Azure Cloud Providers

  • Setup
  • ServiceBus
Edit

Redis

A Redis resource using the StackExchange driver.

Install

Install the Squadron nuget package for Redis within your test project:

dotnet add package Squadron.Redis

Basic usage

public class UserCacheTests : IClassFixture<RedisResource>
{
    private readonly RedisResource _redisResource;

    public UserCacheTests(RedisResource redisResource)
    {
        _redisResource = redisResource;
    }

    [Fact]
    public void Add_AddedUserIsEquivalent()
    {
        //arrange
        var user = User.CreateSample();
        ConnectionMultiplexer connection = _redisResource.GetConnection();
        var repo = new UserCache(connection);

        //act
        repo.Add(user);

        //assert
        User cachedUser = GetUserFromCache(user.Id);
        cachedUser.Should().BeEquivalentTo(user);
    }
}

More samples are available in our samples repo

Last updated on 11/10/2019 by Philippe Birbaum
← PostgreSQLRabbitMQ →
  • Install
  • Basic usage

Community

Contributor License AgreementsCode of Conduct
Swiss Life OSSSwiss Life | OSS
Copyright © 2021 Swiss Life Developers