Search code examples
c#unit-testingasp.net-corein-memory-databaseef-core-2.0

Advantages of using EF core in memory database provider for unit testing of asp.net core application


Is entity framework core in memory database provider replace moq ? What should i use for unit testing in my asp.net core application. I am using asp.net core mvc and ef core 2.0.


Solution

  • In memory database is not a replacement of MOQ; both are two different features.

    MOQ is used for mocking the 3rd party objects or objects beyond the scope of unit test so that unit tests can be written for well effective smaller unit.

    While In memory database is used to validate the data access APIs against the data which one arrange for a unit test. It is designed for testing purposes only.