Moq.Dapper icon indicating copy to clipboard operation
Moq.Dapper copied to clipboard

QuerySingleOrDefault cannot return null

Open goliat26 opened this issue 4 years ago • 1 comments

I have problem. I want to use mock of IDbConnection with setup of QuerySingleOrDefault to return null. I cant do this because i get error "Non-static method requires a target". This is my sample test code: obraz Test class is simple class with 1 property.

I have downloaded the nugget code and check what gives this error. Every "Queryxxx" method is setup by the same way. Returns value is converted to DataTable in every configuration and at the end of this function you added elements to DataTable obraz

But if element is null, an error appears. Why you dont make simple if element is null then continue? Is any reason to dont do this?

goliat26 avatar Oct 07 '21 18:10 goliat26

Similar to https://github.com/UnoSD/Moq.Dapper/issues/54 - also having an issue

simonpinn avatar Jan 13 '22 00:01 simonpinn