Skip to content
Jon P Smith edited this page Jan 4, 2021 · 19 revisions

Welcome to the EfCore.TestSupport wiki!

The NuGet package EfCore.TestSupport is a library containing methods to help you unit test applications that use Entity Framework Core for database access. The examples in this documentation uses xUnit, but these methods can be used with other unit test packages.

This documentation is for EfCore.TestSupport version 5 or above, which old works for EF Core 5.1 and above. If are using the older versions of EF Core you need EfCore.TestSupport, version 3.2.0, and see the Version 3.2.0 docs.

This wiki defines the various groups and the signatures of the methods. The various groups of methods are listed below (see sidebar for links):

  • Helpers to create an in-memory Sqlite database for unit testing
  • Helpers to create connection strings with a unique database name (via appsetting.json)
  • Helpers for creating unique SQL Server databases for unit testing
  • Ways to make sure your database has an up-to-date schema and is empty
  • Helpers to create Cosmos DB databases linked to Azure Cosmos DB Emulator
  • Various tools for getting test data, or file paths to test data
  • A tool for applying a SQL script file to a EF Core database
  • Tools for capturing EF Core logging.
  • xUnit Fluent Validations.

This GitHub repository contains the source of the The NuGet package EfCore.TestSupport is the project TestSupport and various unit tests that check the project TestSupport.

Clone this wiki locally