C
C#2y ago
kaziux

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
toddlahakbar
toddlahakbar2y ago
Define store? Persist between runs?
kaziux
kaziux2y ago
I use one time set up and create context object to persist
toddlahakbar
toddlahakbar2y ago
First thing is first: your ensure deleted and ensure created lines are reverse Probably not the source of the issues but
kaziux
kaziux2y ago
OneTimeSetUp: System.ArgumentException : An item with the same key has already been added. Key: 1 after do reverse with ensure
toddlahakbar
toddlahakbar2y ago
Looks like your seed in your dbcontext conflicts with your seed in your test
kaziux
kaziux2y ago
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