Quickstart
Make sure that you have Docker installed on your machine.
Create a xUnit test project and install one of the available squadron packages.
Provider | Package |
---|---|
Mongo | Squadron.Mongo |
Mongo Replica Set | Squadron.Mongo |
SQL Server | Squadron.SqlServer |
Elastic Search | Squadron.ElasticSearch |
PostgreSQL | Squadron.PostgreSql |
Redis | Squadron.Redis |
RabbitMQ | Squadron.RabbitMQ |
Azure Storage | Squadron.AzureStorage |
Azure ServiceBus | Squadron.AzureCloudServiceBus |
Generic | Squadron.Core |
Compose | Squadron.Compose |
- Use the resource in a
IClassFicture<>
to write you tests.
public class AccountRepositoryTests
: IClassFixture<MongoResource>
{
private readonly MongoResource _mongoResource;
public AccountRepositoryTests(
MongoResource mongoResource)
{
_mongoResource = mongoResource;
}
[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
addedAccount.Should().NotBeNull();
}
}