I am using the Dapper QueryMultipleAsync to split the result of a SQL query into a number of different objects.
However I am having trouble finding a way to unit test the method that this call is in. I have been using Fake it Easy to fake out elements for the unnit tests. As part of the tests I wanted to fake the QueryMultipleAsync to check other calls are made, however which ever way and at whatever level I try this I seam to get errors.
Does anyone have any experience trying to fake out this dapper element? If so how did you do it?
I agree with @Marc Gravell's comment, in that I'd encapsulate all the data access code and test it via integration tests. One other point is that QueryMultipleAsync
is not a virtual method, so it cannot be faked by FakeItEasy; adding a fakeable layer of abstraction is the only way to isolate that call from the code you want to test.