public void OracleDialect() { var dapper = new SqlDialectDapper(); dapper.Init(SqlDialectEnum.Oracle); var sql = dapper.GeneratePagingSql("select * from TestEntity where name = @Name", 2, 10, new { Name = "12" }); Assert.StartsWith("SELECT * FROM (", sql.ToString()); }
public void SqliteDialect() { var dapper = new SqlDialectDapper(); dapper.Init(SqlDialectEnum.Sqlite); var sql = dapper.GeneratePagingSql("select * from TestEntity where name = @Name", 2, 10, new { Name = "12" }); Assert.Equal("select * from TestEntity where name = 12 LIMIT 20, 10", sql.ToString()); }
public void MsSqlDialect() { var dapper = new SqlDialectDapper(); dapper.Init(SqlDialectEnum.MsSql); var sql = dapper.GeneratePagingSql("select * from TestEntity where name = @Name", 2, 10, new { Name = "12" }); Assert.StartsWith("SELECT TOP(10)", sql.Sql); }
public void QueryShouldNotBeNullForGeneratingSql() { var dapper = new SqlDialectDapper(); dapper.Init(SqlDialectEnum.Sqlite); Assert.Throws <ArgumentNullException>("query", () => { dapper.GeneratePagingSql(null, 2, 1, null); }); }