Part of Anarchy I/O Toolkit, a .NET developer platform · Pillar: Infrastructure · Layer: Testing kit · Package catalog

MySQL integration-test helpers for the toolkit’s MySqlConnector persistence adapter.

dotnet add package Anarchy.Toolkit.Testing.Db.Mysql
  • Use MysqlHelper or SingletonMysqlHelper for database fixtures and MysqlOptionsMapper for options mapping.
  • IMysqlAppSettings supports settings-based fixtures; helpers also provide enum handlers and table cleanup.
  • Tests need a MySQL instance and an application schema. MySQL TRUNCATE resets auto-increment and may fail for referenced tables.

When to use it

Use this package in integration tests that must verify actual MySQL SQL, mappings or transaction behavior. It creates toolkit persistence fixtures against a configured server; it does not start MySQL or create application tables.

How to use it

  1. Provision an isolated MySQL database and schema. Implement IMysqlAppSettings on your test settings type; also implement IResilienceAppSettings when creating a resilience policy fixture.
  2. Use MysqlHelper.DbPolicyFixture<TAppSettings>() or pass a settings instance directly; use DbUnitOfWorkFixture for unit-of-work tests. The generic overload reads embedded test settings from the settings type’s assembly.
  3. Register enum handlers when needed, arrange data, execute the repository and assert results. Use the shared database cleanup helpers only on trusted test tables.

SingletonMysqlHelper can share a policy across tests; manage shared state and parallel cleanup carefully. Use a disposable test database, not production credentials.

See Infrastructure.Persistence.Db.Mysql, the MySQL notes and the testing conventions.

Releases

See the release notes for the complete release history.