Richard Banks
Richard Banks

Reputation: 2983

entity framework 4.1 faking dbcontext

Im using the entity framework 4.1 and have followed a tutorial to fake the dbcontext to mock and do unit tests. Everything works as expected with this. ive amended the original dbcontext to return idbset's however when i recreated my model it overwrote this. This is to be expected i suppose but wondered whether there is away i can stop this happening. Any ideas?

Upvotes: 0

Views: 536

Answers (2)

Cubicle.Jockey
Cubicle.Jockey

Reputation: 3328

You can also use moles. But I like the t4 template better.

Upvotes: 0

Richard
Richard

Reputation: 108975

Probably the easiest approach is to replace the T4 templates that do the code generation with your own – copy the default templates into your project and adapt them to generate the code you want.

MSDN has an introduction: http://msdn.microsoft.com/en-us/data/gg558520

Upvotes: 2

Related Questions