This project has moved. For the latest updates, please go here.

EF code first, unit testing relationships

Sep 26, 2014 at 1:09 PM
Hi

I have a parent-child relationship which, when deleting the child, I know from testing in an SQL db that it should not work due to foreign key constraints. When I do this in a unit test with Effort it does work.
Does effort create the database with foreign keys in NMemory or do I need to define the relationships myself? If it does need to be done by me, can you point me in the right direction on how to define the relationships when creating a persistent or transient connection using Effort? At the moment the database is created automatically so I have little control over it and I presume I need to do something extra.

Thanks
Matt
Coordinator
Sep 26, 2014 at 3:28 PM
Edited Sep 26, 2014 at 3:29 PM
Hi,

If you define the entity relations in your Code First model then Effort will automatically create the relations in NMemory.

In the case you have already done that, can you provide a little example?

Cheers,
Tamas