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