Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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.MoqHelper

Article [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)