Need help with EfCore.TestSupport?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

JonPSmith
242 Stars 43 Forks Other 397 Commits 1 Opened issues

Description

Tools for helping in unit testing applications that use Entity Framework Core

Services available

!
?

Need anything else?

Contributors list

# 125,117
C#
CSS
decompi...
entity-...
391 commits
# 519,506
C#
sql-ser...
entity-...
sqlite3
1 commit

EfCore.TestSupport

This NuGet package containing methods to help test applications that use Entity Framework Core for database access using SQL Server, PostgreSQL, Cosmos DB, and a generic in-memory SQLite approach which works with every EF Core database provider (with limitations). This readme provides links to the documentation in the EfCore.TestSupport wiki. Also see Release Notes for information on changes.

The EfCore.TestSupport library is available on NuGet as EfCore.TestSupport and is an open-source library under the MIT license. See ReleaseNotes for details of the changes in each vesion.

NOTE: Version 5.1.0 and above of this library supports multiple versions of EF Core 5.

  • Version 5.1.0 and above supports EF Core 5.10 and EF Core 6.0

WARNING: If you are updating from the original EfCore.TestSupport (2.1 or 3), then you should read the Version5UpgradeDocs.md file as there are some breaking changes in this version.

Documentation

The NuGet package EfCore.TestSupport 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 EfCore.TestSupport wiki.

NOTE: The techniques are explained in much more details in chapter 17 of the book Entity Framework in Action, second edition.

Here is an image covering just a few of the methods available in this library.

Examples of library methods in use

The various groups of tools are:

  1. Helpers to create an in-memory Sqlite database for unit testing.
    See Sqlite in memory test database.
  2. Helpers to create connection strings with a unique database name.
    See Creating connection strings.
  3. Helpers for creating unique SQL Server databases for unit testing.
    See Create SQL Server databases.
  4. Helpers to create Cosmos DB databases linked to Azure Cosmos DB Emulator.
    See Create Cosmos DB options.
  5. Helper for wiping all data and resetting the schema a SQL Server database.
    See Quickly wipe and reset schema on SQL Server.
  6. Various tools for getting test data, or file paths to test data.
    See Test Data tools.
  7. A tool for applying a SQL script file to a EF Core database.
    See Run SQL Script.
  8. Tools for capturing EF Core logging.
    See Capture EF Core logging.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.