SqliteDialect with SqlProc in Unit Tests

Our production db is SQL Server, it’s a legacy system and makes heavy use of stored procedures. Until now we’ve been executing our unit tests against a local SQL Server db. We’d like use an in-memory db instead.

Once we switched the dialect to SqliteDialect we’ve run into a problem when calling SqlProc, it throws a NotSupportedException. I realise that SqlLite doesn’t support stored procedures, but I just want a way of stubbing them. I was hoping to use an ExecFilter for this, but it doesn’t get that far.

What is the recommend way of mocking sprocs in tests when using SqlProc?

The MockStoredProcExecFilter example on OrmLite shows an example of catching an exception and returning mock results:

public class MockStoredProcExecFilter : OrmLiteExecFilter
{
    public override T Exec<T>(IDbConnection dbConn, Func<IDbCommand, T> filter)
    {
        try
        {
            return base.Exec(dbConn, filter);
        }
        catch (Exception ex)
        {
            if (dbConn.GetLastSql() == "exec sp_name @firstName, @age")
                return (T)(object)new Person { FirstName = "Mocked" };
            throw;
        }
    }
}

OrmLiteConfig.ExecFilter = new MockStoredProcExecFilter();

using (var db = OpenDbConnection())
{
    var person = db.SqlScalar<Person>("exec sp_name @firstName, @age",
        new { firstName = "aName", age = 1 });

    person.FirstName.Print(); //Mocked
}