From c4dffaf9ac2d59f361ac51a20e64ddbfd73fe4d1 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Mon, 19 Sep 2022 19:42:42 +0800 Subject: [PATCH] Add unit test --- .../SqlServerTest/SqlServerTest.csproj | 2 + .../SqlServerTest/UnitTest/ITestExo.cs | 7 ++++ Src/Asp.Net/SqlServerTest/UnitTest/Main.cs | 1 + Src/Asp.Net/SqlServerTest/UnitTest/UExp.cs | 39 +++++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 Src/Asp.Net/SqlServerTest/UnitTest/ITestExo.cs create mode 100644 Src/Asp.Net/SqlServerTest/UnitTest/UExp.cs diff --git a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj index a533e40dc..e22e10974 100644 --- a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj +++ b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj @@ -97,6 +97,8 @@ + + diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/ITestExo.cs b/Src/Asp.Net/SqlServerTest/UnitTest/ITestExo.cs new file mode 100644 index 000000000..4369b0b3b --- /dev/null +++ b/Src/Asp.Net/SqlServerTest/UnitTest/ITestExo.cs @@ -0,0 +1,7 @@ +namespace OrmTest +{ + public interface ITestExo + { + Order GetCurrentOrder { get; } + } +} \ No newline at end of file diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs b/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs index 6fb90d321..61cb32fc9 100644 --- a/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs +++ b/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(); diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/UExp.cs b/Src/Asp.Net/SqlServerTest/UnitTest/UExp.cs new file mode 100644 index 000000000..51598389d --- /dev/null +++ b/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().Where(it => it.Id == order.GetCurrentOrder.Id).ToList(); + } + + } + public class TestExo : ITestExo + { + + public Order GetCurrentOrder + { + get + { + return new Order(); + } + } + } +}