update ForUpdate tests

This commit is contained in:
28810
2019-12-14 12:21:55 +08:00
parent 97c1a31a67
commit f162520202
14 changed files with 186 additions and 0 deletions

View File

@ -1603,6 +1603,10 @@ namespace FreeSql.Tests.MySqlConnector
public void ForUpdate()
{
var orm = g.mysql;
Assert.Equal("安全起见,请务必在事务开启之后,再使用 ForUpdate",
Assert.Throws<Exception>(() => orm.Select<ToUpd1Pk>().ForUpdate().Limit(1).ToList())?.Message);
orm.Transaction(() =>
{
var sql = orm.Select<ToUpd1Pk>().ForUpdate().Limit(1).ToSql().Replace("\r\n", "");