Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/owen-krueger/sqlitememorydatabaseprovider
For creating in-memory SQLite databases to be used within unit tests.
https://github.com/owen-krueger/sqlitememorydatabaseprovider
automock automocker database entity-framework entity-framework-core entityframeworkcore net6 net7 net8 sqlite unit-testing
Last synced: 6 days ago
JSON representation
For creating in-memory SQLite databases to be used within unit tests.
- Host: GitHub
- URL: https://github.com/owen-krueger/sqlitememorydatabaseprovider
- Owner: Owen-Krueger
- License: mit
- Created: 2022-12-28T16:42:24.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-15T14:19:19.000Z (9 months ago)
- Last Synced: 2024-05-16T08:38:56.465Z (6 months ago)
- Topics: automock, automocker, database, entity-framework, entity-framework-core, entityframeworkcore, net6, net7, net8, sqlite, unit-testing
- Language: C#
- Homepage:
- Size: 71.3 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# SqliteMemoryDatabaseProvider
[![.NET](https://github.com/Owen-Krueger/SqliteMemoryDatabaseProvider/actions/workflows/dotnet.yml/badge.svg)](https://github.com/Owen-Krueger/SqliteMemoryDatabaseProvider/actions/workflows/dotnet.yml)
According to [Microsoft's documentation](https://learn.microsoft.com/en-us/ef/core/testing/testing-without-the-database#sqlite-in-memory), unit testing Entity Framework should be done with an in-memory database using SQLite. If you look at the link above, you'll see that there's a lot of boilerplate required to set up and use in-memory databases. This provider hopes to do much of the boilerplate behind the scenes so developers can write tests easier without having to worry about setting up their test databases correctly.
There are two packages offered within this repo:
- SqliteMemoryDatabaseProvider: Aids with creating in-memory databases for unit tests.
- SqliteMemoryDatabaseProvider.AutoMocker: Provides overloads for `AutoMocker` and `DbContext` to aid with creating in-memory databases for unit tests.## Requirements
Using these packages requires the project to be on .NET 6.0 or newer. These packages should only be used with projects using EntityFramework version 6.x.x or higher on .NET 6.0, version 7.x.x on .NET 7.0, or version 8.x.x on .NET 8.0.
## Contribute
If you encounter an issue or want to contribute to this package, please visit this package's [GitHub page](https://github.com/Owen-Krueger/SqliteMemoryDatabaseProvider).