This git repo contains the source of the EfCore.TestSupport library, and various tests to check the EfCore.TestSupport NuGet package.
See Release Notes for information on changes.
This project is open-source (MIT licence) and works for EF Core 2.1 (netstandard2.0) and EF Core 3 (netstandard2.1).
The NuGet package EfCore.TestSupport is a netstandard2.0 library containing methods to help you unit test applications that use
Entity Framework Core for database access. This readme defines the various groups, with links to the documentation in the
NOTE: The techniques are explained in much more details in chapter 15 of the book Entity Framework in Action.
Here is an image covering just a few of the methods, in bold available in this library.
The various groups of tools are:
- Helpers to create an in-memory Sqlite database for unit testing.
See Sqlite in memory test database.
- Helpers to create an InMemory database for unit testing.
See EF InMemory test database.
- Helpers to create connection strings with a unique database name.
See Creating connection strings.
- Helpers for creating unique SQL Server databases for unit testing.
See Create SQL Server databases.
- Helpers to create Cosmos DB databases linked to Azure Cosmos DB Emulator.
See Create Cosmos DB options.
- Helpers for creating an empty database, and deleting SQL unit test databases.
See Quickly create empty databases.
- Various tools for getting test data, or file paths to test data.
See Test Data tools.
- A tool for applying a SQL script file to a EF Core database.
See Run SQL Script.
- Tools for capturing EF Core logging.
See Capture EF Core logging.
- Tool to compare EF Core's view of the database with an actual database.
- Capture cleaned production data to supply better data for unit tests.
See Seed from Production feature.