You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As test data I add two users without assigning their ids:
conext.Users.Add(new User {Name="Peter"});
conext.Users.Add(new User {Name="Paul"});
My DBContext sometimes contains: Peter (id:3) and Paul (id:4) if I run the tests. I am not sure if this only occurs on tests that are using a [Theory].
(If I explicitly set the ids while adding the users it works as expected. This workaround solves the issue in my case.)
InMemory is not a relational provider - it is unfortunate the the extension method is named AddEntityFrameworkInMemoryDatabase rather than AddEntityFrameworkInMemoryProvider or similar
I wrote some tests using Xunit. Every [Fact] method creates a new DBContext to test.
An User has the property ID
As test data I add two users without assigning their ids:
My DBContext sometimes contains: Peter (id:3) and Paul (id:4) if I run the tests. I am not sure if this only occurs on tests that are using a [Theory].
(If I explicitly set the ids while adding the users it works as expected. This workaround solves the issue in my case.)
Further technical details
EF Core version: "Microsoft.NETCore.App": { "version": "1.1.0", "type": "platform" },
Database Provider: InMemoryDatabase
Operating system: macOS Sierra 10.12.1
IDE: JetBrains Rider 1.0 EAP
The text was updated successfully, but these errors were encountered: