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

后端 未结 7 1189
忘掉有多难
忘掉有多难 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:36

    The following call will clear the in-memory datastore.

    _context.Database.EnsureDeleted();
    

提交回复
热议问题