mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-05 17:37:58 +08:00
Add unit test
This commit is contained in:
parent
fc40a77097
commit
5ff7554497
@ -102,6 +102,7 @@
|
||||
<Compile Include="UnitTest\Updateable.cs" />
|
||||
<Compile Include="UnitTest\UQueryable.cs" />
|
||||
<Compile Include="UnitTest\UQueryableAsync.cs" />
|
||||
<Compile Include="UnitTest\USaveable.cs" />
|
||||
<Compile Include="UnitTest\UThread.cs" />
|
||||
<Compile Include="UnitTest\UThread2.cs" />
|
||||
<Compile Include="UnitTest\UThread3.cs" />
|
||||
|
@ -31,6 +31,7 @@ namespace OrmTest
|
||||
}
|
||||
public static void Init()
|
||||
{
|
||||
USaveable.Init();
|
||||
UnitSubToList.Init();
|
||||
UnitByteArray.Init();
|
||||
Unit01.Init();
|
||||
|
49
Src/Asp.Net/SqliteTest/UnitTest/USaveable.cs
Normal file
49
Src/Asp.Net/SqliteTest/UnitTest/USaveable.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
internal class USaveable
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
List();
|
||||
T();
|
||||
}
|
||||
|
||||
private static void T()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
object o1 = new Order() { Id = 1, CreateTime = DateTime.Now, CustomId = 1, Name = "a", Price = 1 };
|
||||
db.StorageableByObject(o1).ExecuteCommand();
|
||||
|
||||
object o2 = new Order() { Id = 0, CreateTime = DateTime.Now, CustomId = 1, Name = "a", Price = 1 };
|
||||
db.StorageableByObject(o2).ExecuteCommand();
|
||||
|
||||
}
|
||||
|
||||
private static void List()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
List<object> o1 = new List<object>() { new Order() { Id = 0, CreateTime = DateTime.Now, CustomId = 1, Name = "a", Price = 1 } };
|
||||
db.StorageableByObject(o1).ExecuteCommand();
|
||||
o1 = new List<object>() { new Order() { Id = 1, CreateTime = DateTime.Now, CustomId = 1, Name = "a", Price = 1 } };
|
||||
db.StorageableByObject(o1).ExecuteCommand();
|
||||
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("insert update");
|
||||
|
||||
List<object> o2 = new List<object>() { new Order() { Id = 1, CreateTime = DateTime.Now, CustomId = 1, Name = "a", Price = 1 }, new Order() { Id = 0, CreateTime = DateTime.Now, CustomId = 1, Name = "a", Price = 1 } };
|
||||
var x = db.StorageableByObject(o2).ToStorage();
|
||||
x.AsInsertable.ExecuteCommand();
|
||||
x.AsUpdateable.ExecuteCommand();
|
||||
|
||||
object o = db.Queryable<Order>().ToList();
|
||||
db.StorageableByObject(o).ExecuteCommand();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user