UnoSD / Moq.Dapper

Moq extensions for Dapper methods.
GNU General Public License v2.0
173 stars 78 forks source link

QuerySingleOrDefault cannot return null #73

Open goliat26 opened 3 years ago

goliat26 commented 3 years ago

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?

simonpinn commented 2 years ago

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