InMemory testing doesn't store seeded data
https://github.com/Nemes1sX/EmployeeMangement/blob/master/EmployeeTest/TestEmployee.cs. For example when I tried to fetch seeded data I get 0 records and hence test is failed. How to fix that?
6 Replies
Define store? Persist between runs?
I use one time set up and create context object to persist
First thing is first: your ensure deleted and ensure created lines are reverse
Probably not the source of the issues but
OneTimeSetUp: System.ArgumentException : An item with the same key has already been added. Key: 1 after do reverse with ensure
Looks like your seed in your dbcontext conflicts with your seed in your test
I copy paste paste seed into private function in the test
When I commented out Seed function I get the same error
as the begining
OnModel function in the data context I use seeding