Unit Testing DbContexts and queries – the status quo

So here’s the scene. I’ve been working on unit testing for a solid day, my percent coverage is up, my code is better factored, and now I do my ‘what is the most untested class I have’ analysis one more time, and discover that it is… ‘BillingEntitiesContext’. BillingEntitiesContext is my subclassed DbContext for describing my…

3

If only you could set properties on fakes.

I’m using this library called FakeItEasy. The more I use it the more I like it. While using it I suddenly thought: var fakeIdentity = A.Fake<IIdentity>() { Name = “foo” }; Would be so much simpler than var fakeIdentity = A.Fake<IIdentity>();A.CallTo(() => fakeIdentity.Name).Returns(“foo”); especially when it could be inlined without needing to introduce this fakeIdentity…

2