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

后端 未结 7 1185
忘掉有多难
忘掉有多难 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.<Entity>.RemoveRange(db.<entity>);
    
    0 讨论(0)
提交回复
热议问题