mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 13:06:50 +08:00
Add user test case
This commit is contained in:
parent
2961f92823
commit
4b334b47e5
@ -65,6 +65,7 @@
|
|||||||
<Compile Include="a8_SelectReturnType.cs" />
|
<Compile Include="a8_SelectReturnType.cs" />
|
||||||
<Compile Include="UnitTest\Description.cs" />
|
<Compile Include="UnitTest\Description.cs" />
|
||||||
<Compile Include="UserTestCases\Bugs\BugTest.cs" />
|
<Compile Include="UserTestCases\Bugs\BugTest.cs" />
|
||||||
|
<Compile Include="UserTestCases\Cases\UnitAny.cs" />
|
||||||
<Compile Include="UserTestCases\Cases\Unitasdfas2yy.cs" />
|
<Compile Include="UserTestCases\Cases\Unitasdfas2yy.cs" />
|
||||||
<Compile Include="UserTestCases\Cases\Unitasdfasdfa1.cs" />
|
<Compile Include="UserTestCases\Cases\Unitasdfasdfa1.cs" />
|
||||||
<Compile Include="UserTestCases\Config.cs" />
|
<Compile Include="UserTestCases\Config.cs" />
|
||||||
|
@ -10,6 +10,7 @@ namespace OrmTest
|
|||||||
{
|
{
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
|
UnitAny.Init();
|
||||||
Unitdfaafas.Init();
|
Unitdfaafas.Init();
|
||||||
Unitasdfasdfa1.Init();
|
Unitasdfasdfa1.Init();
|
||||||
//Demo
|
//Demo
|
||||||
|
42
Src/Asp.Net/SqliteTest/UserTestCases/Cases/UnitAny.cs
Normal file
42
Src/Asp.Net/SqliteTest/UserTestCases/Cases/UnitAny.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OrmTest
|
||||||
|
{
|
||||||
|
internal class UnitAny
|
||||||
|
{
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
var db = NewUnitTest.Db;
|
||||||
|
db.CodeFirst.InitTables<UintAnyModel>();
|
||||||
|
var id=db.Insertable(new UintAnyModel() {
|
||||||
|
Name="a"
|
||||||
|
}).ExecuteReturnIdentity();
|
||||||
|
if (db.Queryable<UintAnyModel>().Any(it => it.Id == id) == false)
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
|
if (db.Queryable<UintAnyModel>().Any(it => it.Id == 971151111) == true)
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
|
if (db.Queryable<UintAnyModel>().AnyAsync(it => it.Id == id).GetAwaiter().GetResult() == false)
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
|
if (db.Queryable<UintAnyModel>().AnyAsync(it => it.Id == 971151111).GetAwaiter().GetResult() == true)
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class UintAnyModel
|
||||||
|
{
|
||||||
|
[SqlSugar.SugarColumn(IsPrimaryKey =true,IsIdentity =true)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user