Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/karenpayneoregon/entity-framework6-mocking
Entity Framework 6 example to unit test and restore data to original state.
https://github.com/karenpayneoregon/entity-framework6-mocking
csharp entity-framework unit-testing
Last synced: 5 days ago
JSON representation
Entity Framework 6 example to unit test and restore data to original state.
- Host: GitHub
- URL: https://github.com/karenpayneoregon/entity-framework6-mocking
- Owner: karenpayneoregon
- Created: 2021-08-02T14:14:26.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-27T15:01:33.000Z (about 2 years ago)
- Last Synced: 2024-11-30T19:25:14.364Z (2 months ago)
- Topics: csharp, entity-framework, unit-testing
- Language: C#
- Homepage:
- Size: 42 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# About
Alternate method of testing w/o touching the database for `Entity Framework 6`.
https://github.com/RichardSilveira/EntityFramework.MoqHelper
Install-Package EntityFramework.MoqHelperArticle [Testing-with-mock-on-Entity-Framework](https://www.codeproject.com/Tips/1045590/Testing-with-mock-on-Entity-Framework)
Another [approach](https://blog.goyello.com/2016/07/14/save-time-mocking-use-your-real-entity-framework-dbcontext-in-unit-tests/) (it's shown in C# but is easy to translate)
# Data scripts
Run script.sql in the script folder before running any test.
# Note
This is done using a .edmx method to work with Entity Framework, will also work with code first approach.
# TechNet article
[Entity Framework unit testing with mocked data and auto cleanup of data](https://social.technet.microsoft.com/wiki/contents/articles/51477.entity-framework-unit-testing-with-mocked-data-and-auto-cleanup-of-data.aspx)