I want the Mock to return the SQL statement and Not execute the statement. This is what i have done but it keeps running the "connection.execution(SQL)".
string SQL = "";
Mock.Arrange(() => connection.Execute(Arg.AnyString, null, null, null, null)).DoInstead((string arg1) => { SQL = arg1; }).IgnoreInstance().Returns(1);
WebApiProject.Controllers.DeleteController dc = new WebApiProject.Controllers.DeleteController();
dc.Post(mockedDeleteObject);
Assert.IsTrue(SQL == $"DELETE FROM TEST WHERE 1=1");
Post{
string SQL;
SQL = $"delete from {TableName} where {WhereClause} ";
con.Execute(SQL,parameters );}
But it keeps running the sql executable statement