public static DapperMock Compile(string text, string database) { var assembly = ExcessMock.Build(text, builder: compiler => { Functions.Apply(compiler); DapperExtension.Apply(compiler); }, referenceTypes: new[] { typeof(Dapper.SqlMapper), typeof(__Scope), typeof(IDbConnection), typeof(IEnumerable <>), typeof(SqlConnection), typeof(SQLiteConnection), typeof(Component), }); if (assembly == null) { throw new InvalidOperationException(); } var connection = new SQLiteConnection(ConnectionString); connection.Open(); if (database != null) { connection.Execute(database); } return(new DapperMock(assembly, connection)); }