UnoSD / Moq.Dapper

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

Cannot moq 'Execute' after mocking 'QuerySingle<int>' #75

Open Abinaya-Krishnan opened 3 years ago

Abinaya-Krishnan commented 3 years ago

I want to mock both QuerySingle and Execute functions. Mocking 'Execute' after QuerySingle throws error. The error says

Message:

moqConnection.SetupDapper(c => c.QuerySingle("yyy", null, null, null, null)).Returns(-4); moqConnection.SetupDapper(c => c.Execute("zzz", null, null, null, null)).Returns(-44);

var actual1 = moqConnection.Object.QuerySingle("yyy"); var actual2 = moqConnection.Object.Execute("zzz");

In the above example, if I swap 'QuerySingle' and 'Execute' then the code works.