Add unit test

This commit is contained in:
sunkaixuan 2023-09-13 13:49:23 +08:00
parent 8f04739e20
commit d435b21326

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
@ -40,8 +41,24 @@ namespace OrmTest
db.DeleteNav(address).IncludeByNameString("Persons")
.IncludeByNameString("City").ExecuteCommand();
db.CodeFirst.InitTables<UnitTesta>();
db.CurrentConnectionConfig.MoreSettings = new SqlSugar.ConnMoreSettings() { EnableCodeFirstUpdatePrecision = true };
db.CodeFirst.InitTables<UNITTESTA>();
var data= db.DbMaintenance.GetColumnInfosByTableName("UNITTESTA", false);
if (data.First().DecimalDigits != 6)
{
throw new Exception("unit error");
}
}
public class UnitTesta
{
[SqlSugar.SugarColumn(Length =18,DecimalDigits =4)]
public decimal xx { get; set; }
}
public class UNITTESTA
{
[SqlSugar.SugarColumn(Length = 18, DecimalDigits = 6)]
public decimal xx { get; set; }
}
[SqlSugar.SugarTable("UnitPerson01x1")]