From ea2fd3ccd9ccfa51a4350919929525ae147a58b3 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Mon, 20 Nov 2023 03:55:20 +0800 Subject: [PATCH] Add user test cases --- .../SqliteTest/UserTestCases/UCodeFirst.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Src/Asp.NetCore2/SqliteTest/UserTestCases/UCodeFirst.cs b/Src/Asp.NetCore2/SqliteTest/UserTestCases/UCodeFirst.cs index eca277018..69aa7bf74 100644 --- a/Src/Asp.NetCore2/SqliteTest/UserTestCases/UCodeFirst.cs +++ b/Src/Asp.NetCore2/SqliteTest/UserTestCases/UCodeFirst.cs @@ -29,7 +29,39 @@ namespace OrmTest if (x[1].Length != 18 && x[1].Scale != 2) throw new Exception("unit test error"); if (x[2].Length != 0 && x[2].Scale != 0) throw new Exception("unit test error"); Db.CodeFirst.InitTables(); + Db.CodeFirst.InitTables(); + Db.CodeFirst.InitTables(); + var column= Db.DbMaintenance.GetColumnInfosByTableName("UNITDROPCOLUMNTEST", false); + if (column.Count != 3) + { + throw new Exception("unit error"); + } + + var db = Db; + db.CurrentConnectionConfig.MoreSettings = new ConnMoreSettings() + { + SqliteCodeFirstEnableDropColumn=true + }; + db.CodeFirst.InitTables(); + var column2 = db.DbMaintenance.GetColumnInfosByTableName("UNITDROPCOLUMNTEST", false); + if (column2.Count != 2) + { + throw new Exception("unit error"); + } } + + public class UnitDropColumnTest + { + public int Id { get; set; } + public string Name { get; set; } + public string Name2 { get; set; } + } + public class UNITDROPCOLUMNTEST + { + public int Id { get; set; } + public string Name { get; set; } + } + [SqlSugar.SugarIndex("UnitIndextestIndex", nameof(UnitIndextest.Table), SqlSugar.OrderByType.Asc)] public class UnitIndextest {