mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Add unit test
This commit is contained in:
parent
b0c4b4a583
commit
d095f9527e
@ -120,6 +120,7 @@
|
||||
<Compile Include="Models\Unit\Custom1\PurchaseDetailModel.cs" />
|
||||
<Compile Include="Models\ViewOrder.cs" />
|
||||
<Compile Include="Demo\DemoJ_Report.cs" />
|
||||
<Compile Include="UnitTest\UnitDateTimeOffset.cs" />
|
||||
<Compile Include="UnitTest\UinitCustomConvert.cs" />
|
||||
<Compile Include="UnitTest\Unitadsfasf1.cs" />
|
||||
<Compile Include="UnitTest\CrossDatabase02.cs" />
|
||||
|
@ -31,6 +31,7 @@ namespace OrmTest
|
||||
}
|
||||
public static void Init()
|
||||
{
|
||||
UnitDateTimeOffset.Init();
|
||||
UinitCustomConvert.Init();
|
||||
Unitadsfasf1.Init();
|
||||
UnitSubToList001.Init();
|
||||
|
44
Src/Asp.Net/MySqlTest/UnitTest/UnitDateTimeOffset.cs
Normal file
44
Src/Asp.Net/MySqlTest/UnitTest/UnitDateTimeOffset.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
internal class UnitDateTimeOffset
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
|
||||
db.DbMaintenance.CreateDatabase();
|
||||
//建表
|
||||
|
||||
db.CodeFirst.InitTables<Test>();
|
||||
|
||||
SnowFlakeSingle.WorkId = 1;
|
||||
|
||||
var test = new Test() { Name = "A", Date = DateTimeOffset.Now };
|
||||
|
||||
var id = db.Insertable(test).ExecuteReturnSnowflakeId();
|
||||
test = db.Queryable<Test>().First(v => v.Id == id);
|
||||
|
||||
//Console.ReadKey();
|
||||
|
||||
}
|
||||
|
||||
[SugarTable("unittest121")]
|
||||
public class Test
|
||||
{
|
||||
|
||||
public string Name { get; set; }
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
public DateTimeOffset Date { get; set; } = DateTimeOffset.MinValue;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user