Browse Source

Add unit test

pull/40/head
sunkaixuan 1 year ago
parent
commit
10950e15db
  1. 1
      Src/Asp.Net/SqlServerTest/SqlServerTest.csproj
  2. 1
      Src/Asp.Net/SqlServerTest/UnitTest/Main.cs
  3. 32
      Src/Asp.Net/SqlServerTest/UnitTest/UEnum2.cs

1
Src/Asp.Net/SqlServerTest/SqlServerTest.csproj

@ -102,6 +102,7 @@
<Compile Include="UnitTest\Models\001\ShoujiSubnum.cs" />
<Compile Include="UnitTest\Models\001\ShoujiViewDto.cs" />
<Compile Include="UnitTest\Models\Unit23131.cs" />
<Compile Include="UnitTest\UEnum2.cs" />
<Compile Include="UnitTest\UinitCustomConvert.cs" />
<Compile Include="UnitTest\UInsert3.cs" />
<Compile Include="UnitTest\UJson2.cs" />

1
Src/Asp.Net/SqlServerTest/UnitTest/Main.cs

@ -31,6 +31,7 @@ namespace OrmTest
}
public static void Init()
{
UEnum2.Init();
UnitManyToMany4.Init();
UnitManyToMany3.Init();
UnitUpdateOneToMany.Init();

32
Src/Asp.Net/SqlServerTest/UnitTest/UEnum2.cs

@ -0,0 +1,32 @@
using SqlSugar;
using SqlSugar.DbConvert;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
internal class UEnum2
{
public static void Init()
{
var db = NewUnitTest.Db;
db.CodeFirst.InitTables<Unitadfas3>();
db.Insertable(new Unitadfas3() { DbType = SqlSugar.DbType.GBase }).ExecuteCommand();
var first = db.Queryable<Unitadfas3>().First();
db.Updateable(first).ExecuteCommand();
var first2 = db.Queryable<Unitadfas3>().First();
}
public class Unitadfas3
{
[SugarColumn(IsPrimaryKey =true,IsIdentity =true)]
public int id { get; set; }
[SugarColumn(ColumnDataType ="varchar(20)",SqlParameterDbType =typeof(EnumToStringConvert))]
public SqlSugar.DbType DbType { get; set; }
}
}
}
Loading…
Cancel
Save