Update unit test

This commit is contained in:
sunkaixuan 2022-04-16 22:46:25 +08:00
parent fdf61ea746
commit 7ba375ab80
2 changed files with 15 additions and 5 deletions

View File

@ -337,7 +337,9 @@ namespace SqlSugar
DbColumnName = dataReader.GetString(1),
DefaultValue = dataReader.GetValue(4).ObjToString(),
IsPrimarykey = dataReader.GetBoolean(5).ObjToBool(),
Length = length
Length = length,
DecimalDigits=decimalDigits,
Scale= decimalDigits
};
result.Add(column);
}

View File

@ -18,16 +18,24 @@ namespace OrmTest
Db.Insertable(new Test00111()).ExecuteCommand();
var list = Db.Queryable<Test00111>().ToList();
Db.CodeFirst.InitTables<Test00111121>();
Db.CodeFirst.InitTables<UnitByteArray>();
Db.Insertable(new UnitByteArray()
Db.CodeFirst.InitTables<UnitByteArray1>();
Db.Insertable(new UnitByteArray1()
{
Data = new byte[] { 1, 2, 123, 31, 1 }
}).ExecuteCommand();
var list2=Db.Queryable<UnitByteArray>().ToDataTable();
var list2=Db.Queryable<UnitByteArray1>().ToDataTable();
var x=Db.DbMaintenance.GetColumnInfosByTableName("`UnitByteArray1`", false);
if (x[0].Length != 18 && x[0].Scale != 0) throw new Exception("unit test error");
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");
}
public class UnitByteArray
public class UnitByteArray1
{
[SugarColumn(IsNullable = true, ColumnDataType = "varchar(18)")]
public string Aa { get; set; }
[SugarColumn(IsNullable =true, ColumnDataType = "decimal(18,2)")]
public decimal A { get; set; }
public byte[] Data { get; set; }
}
public class Test00111121