Respawn is a small library to help reset your database to a known state before tests. If you're like our teams and rely on integration/subcutaneous tests as your final "green" test for feature complete, keeping a consistent database state can be frustrating. Respawn solves this problem by intelligently wiping your local test database clean before each test:

var checkpoint = new Checkpoint();

await checkpoint.Reset("MyConnectionStringName");

// or

await checkpoint.Reset(dbConnection);

Respawn works by inspecting the foreign key relationships of your database and building a depth-first order of deleting tables. Benchmarks show this is faster than doing a "disable FK/truncate/enable FK" process by about 3x, and much faster than creating a database from scratch.

For a full example in xUnit integration tests, check out my Contoso University example projects: