From 9ead049ea600db851c498cccec89953148ea74b6 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Fri, 21 Oct 2022 12:26:06 +0800 Subject: [PATCH] Add unit test --- Src/Asp.Net/SqlServerTest/UnitTest/ULock.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/ULock.cs b/Src/Asp.Net/SqlServerTest/UnitTest/ULock.cs index 9be252b40..785d862dc 100644 --- a/Src/Asp.Net/SqlServerTest/UnitTest/ULock.cs +++ b/Src/Asp.Net/SqlServerTest/UnitTest/ULock.cs @@ -32,6 +32,24 @@ namespace OrmTest Ver = 0 }).ExecuteCommandWithOptLock(); if (data2 != 0) { throw new Exception("unit error"); }; + + var data3 = db.Updateable(new ULockEntity() + { + Id = id, + Name = "newname2", + Ver = 0 + }) + .UpdateColumns(z=>z.Name).ExecuteCommandWithOptLock(); + if (data3 != 0) { throw new Exception("unit error"); } + var ver = db.Queryable().InSingle(id); + var data4 = db.Updateable(new ULockEntity() + { + Id = id, + Name = "newname2", + Ver = ver.Ver + }) + .UpdateColumns(z => z.Name).ExecuteCommandWithOptLock(); + if (data4 != 0) { throw new Exception("unit error"); } } public class ULockEntity