0

I'm looking to test my code with AutoFixture. I feel that the tool has potential but it is getting hard to effectively setup just to run my first test.

I'm using EF6 code first. Then, the most logical is that AutoFixture.AutoEF will do all the work for you but it is not the case because you need to explicitly setup your DbSet's objects. I found the following solution on the web but the problem now is that I just cannot setup an open generic type. So below is my (incomplete) code. What could I do to finish this?

Thank you.

enter image description here

Adanay Martín
  • 397
  • 1
  • 3
  • 15
  • What is AutoFixture.AutoEF? – Nikos Baxevanis Nov 26 '16 at 16:03
  • I'm not sure since I'm new to this but it looks like this is for setup fake entities with the right navigation properties. See https://github.com/alexfoxgill/AutoFixture.AutoEntityFramework/tree/master/src/AutoFixture.AutoEF – Adanay Martín Nov 26 '16 at 16:24
  • Have not read but is this related to this? http://stackoverflow.com/questions/10092446/autofixture-configuring-an-open-generics-specimen-builder – Ruben Bartelink Nov 26 '16 at 19:21
  • I could not tell. I hope someone tells me. – Adanay Martín Nov 26 '16 at 23:56
  • @AdanayMartin You need to at people (like <-) for them to know you've responded. I'll make my comment clearer: In the other question, I believe I have an approach, but because I don't have any EF-specific constraints it may not be appropriate. Please read the answer I linked and indicate for future readers (perhaps by clarifying your question or providing another req therein) whether it is what you're talking about – Ruben Bartelink Nov 27 '16 at 07:43

1 Answers1

1

Well, this is the best I have found so far to solve my problem. If you can improve it I will appreciated.

enter image description here

Adanay Martín
  • 397
  • 1
  • 3
  • 15