Browse Source

Add unit test

SqlSugar5
sunkaixuan 2 years ago
parent
commit
c4dffaf9ac
  1. 2
      Src/Asp.Net/SqlServerTest/SqlServerTest.csproj
  2. 7
      Src/Asp.Net/SqlServerTest/UnitTest/ITestExo.cs
  3. 1
      Src/Asp.Net/SqlServerTest/UnitTest/Main.cs
  4. 39
      Src/Asp.Net/SqlServerTest/UnitTest/UExp.cs

2
Src/Asp.Net/SqlServerTest/SqlServerTest.csproj

@ -97,6 +97,8 @@
<Compile Include="Models\OrderItem.cs" />
<Compile Include="Demo\Demo0_SqlSugarClient.cs" />
<Compile Include="Models\ViewOrder.cs" />
<Compile Include="UnitTest\ITestExo.cs" />
<Compile Include="UnitTest\UExp.cs" />
<Compile Include="UnitTest\UCustom24.cs" />
<Compile Include="UnitTest\UCustom20.cs" />
<Compile Include="UnitTest\UnitUpdateSubQuery.cs" />

7
Src/Asp.Net/SqlServerTest/UnitTest/ITestExo.cs

@ -0,0 +1,7 @@
namespace OrmTest
{
public interface ITestExo
{
Order GetCurrentOrder { get; }
}
}

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

@ -31,6 +31,7 @@ namespace OrmTest
}
public static void Init()
{
UExp.Init();
USelectSinleDTO.Init();
UCustom024.Init();
UCustom24.Init();

39
Src/Asp.Net/SqlServerTest/UnitTest/UExp.cs

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class UExp
{
public static void Init()
{
new UExp().Test();
}
private readonly ITestExo order;
public UExp()
{
order = new TestExo();
}
public void Test()
{
var list = NewUnitTest.Db.Queryable<Order>().Where(it => it.Id == order.GetCurrentOrder.Id).ToList();
}
}
public class TestExo : ITestExo
{
public Order GetCurrentOrder
{
get
{
return new Order();
}
}
}
}
Loading…
Cancel
Save