/squadron

A testing framework for containerized and cloud services

Primary LanguageC#MIT LicenseMIT

Snapshooter

Nuget GitHub Release Build status Coverage Status Quality

Squadron is a testing framework for containerized and cloud services.

Squadron is a helpful framework which enables you to write tests against dependent services without any overhead. Squadron can provide you isolation in tests through Container Providers or support for all other services through Cloud Providers.

To get more detailed information about Squadron, go to the Squadron Docs

Features

Container Providers

Cloud Providers

Getting Started

As getting started we've prepared a simple example how to use Squadron with MongoDB.

You can find samples with quick starts here.

Install

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

dotnet add package Squadron.Mongo

Access

Inject the MongoResource into your test class constructor:

public class AccountRepositoryTests
    : IClassFixture<MongoResource>
{
    private readonly MongoResource _mongoResource;

    public AccountRepositoryTests(
        MongoResource mongoResource)
    {
        _mongoResource = mongoResource;
    }
}

Use

Use MongoResources to create a database and initialize your repository:

[Fact]
public void CreateAccount_AccountExists()
{
    // arrange
    var database = _mongoResource.CreateDatabase();
    var accountRepository = new AccountRepository(database);
    var account = new Account();

    // act
    var addedAccount = accountRepository.Add(account);

    // assert
    Snapshot.Match(addedAccount);
}

Community

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information, see the Swiss Life OSS Code of Conduct.