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
As getting started we've prepared a simple example how to use Squadron with MongoDB.
You can find samples with quick starts here.
Install the Squadron nuget package for MongoDB within your test project:
dotnet add package Squadron.Mongo
Inject the MongoResource into your test class constructor:
public class AccountRepositoryTests
: IClassFixture<MongoResource>
{
private readonly MongoResource _mongoResource;
public AccountRepositoryTests(
MongoResource mongoResource)
{
_mongoResource = mongoResource;
}
}
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);
}
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.