Skip to content
Jon P Smith edited this page Dec 14, 2024 · 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.

It has specific database code for:

  • SQL Server
  • PostgreSQL
  • Cosmos DB
  • Plus an in-memory database using SQLite (faster for simple EF Core databases)

List of versions and which .NET framework they support

Since .NET 8 this library only supports one .NET. This change makes it easier to update to the next .NET release.

  • Version 9.?.? supports NET 9 only
  • Version 8.?.? supports NET 8 only
  • Version 6.?.?: Supports NET 6, 7 and 8
  • Version 5.2.?: Supports NET 5, 6 and 7

There are older versions of the EfCore.TestSupport library, but .NET lower than .NET 5 are not supported by Microsoft.

The documentation topics are

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 connection strings with a unique database name (via appsetting.json)
  • Methods to create EF Core databases
    • SQLite in-memory databases
    • SQL Server databases
    • Cosmos DB emulator databases
    • Add EF Core logging to any of the database types
  • Seed from Production feature
  • 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
  • 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