How can I reset an EF7 InMemory provider between unit tests?

后端 未结 7 1224
忘掉有多难
忘掉有多难 2021-01-31 13:01

I am trying to use the EF7 InMemory provider for unit tests, but the persistent nature of the InMemory database between tests is causing me problems.

The following code d

7条回答
  •  长情又很酷
    2021-01-31 13:58

    The examples here achieve this through RemoveRange: https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-3.1

    db..RemoveRange(db.);
    

提交回复
热议问题