From 0750abf8c73916dc62cee932cb6ccd66d490508d Mon Sep 17 00:00:00 2001
From: old yi <156663459@qq.com>
Date: Wed, 27 Mar 2024 22:29:15 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0Tests=E9=A1=B9=E7=9B=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
New_College.Api/New_College.Api.csproj | 2 +-
New_College.Tests/DependencyInjection/DI_Test.cs | 9 +++++----
New_College.Tests/New_College.Tests.csproj | 9 +++++----
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/New_College.Api/New_College.Api.csproj b/New_College.Api/New_College.Api.csproj
index 712b0b2..fcae1c7 100644
--- a/New_College.Api/New_College.Api.csproj
+++ b/New_College.Api/New_College.Api.csproj
@@ -52,7 +52,7 @@
-
+
diff --git a/New_College.Tests/DependencyInjection/DI_Test.cs b/New_College.Tests/DependencyInjection/DI_Test.cs
index 4704ed1..ade426d 100644
--- a/New_College.Tests/DependencyInjection/DI_Test.cs
+++ b/New_College.Tests/DependencyInjection/DI_Test.cs
@@ -22,6 +22,7 @@ using System.Reflection;
using System.Security.Claims;
using System.Text;
using Xunit;
+using Microsoft.Extensions.PlatformAbstractions;
namespace New_College.Tests
{
@@ -31,7 +32,7 @@ namespace New_College.Tests
[Fact]
public void DI_Connet_Test()
{
- var basePath = Microsoft.DotNet.PlatformAbstractions.ApplicationEnvironment.ApplicationBasePath;
+ var basePath = PlatformServices.Default.Application.ApplicationBasePath;
IServiceCollection services = new ServiceCollection();
services.AddAutoMapper(typeof(Startup));
@@ -43,7 +44,7 @@ namespace New_College.Tests
ConnectionString = GetMainConnectionDb().Connection,//必填, 数据库连接字符串
DbType = (SqlSugar.DbType)GetMainConnectionDb().DbType,//必填, 数据库类型
IsAutoCloseConnection = true,//默认false, 时候知道关闭数据库连接, 设置为true无需使用using或者Close操作
- IsShardSameThread = true,//共享线程
+ // sh = true,//共享线程
InitKeyType = SqlSugar.InitKeyType.SystemTable//默认SystemTable, 字段信息读取, 如:该属性是不是主键,标识列等等信息
});
});
@@ -108,7 +109,7 @@ namespace New_College.Tests
public IContainer DICollections()
{
- var basePath = Microsoft.DotNet.PlatformAbstractions.ApplicationEnvironment.ApplicationBasePath;
+ var basePath = PlatformServices.Default.Application.ApplicationBasePath;
IServiceCollection services = new ServiceCollection();
services.AddAutoMapper(typeof(Startup));
@@ -156,7 +157,7 @@ namespace New_College.Tests
ConnectionString = GetMainConnectionDb().Connection,//必填, 数据库连接字符串
DbType = (SqlSugar.DbType)GetMainConnectionDb().DbType,//必填, 数据库类型
IsAutoCloseConnection = true,//默认false, 时候知道关闭数据库连接, 设置为true无需使用using或者Close操作
- IsShardSameThread = true,//共享线程
+ // IsShardSameThread = true,//共享线程
InitKeyType = SqlSugar.InitKeyType.SystemTable//默认SystemTable, 字段信息读取, 如:该属性是不是主键,标识列等等信息
});
});
diff --git a/New_College.Tests/New_College.Tests.csproj b/New_College.Tests/New_College.Tests.csproj
index 15964b1..1bcfb3c 100644
--- a/New_College.Tests/New_College.Tests.csproj
+++ b/New_College.Tests/New_College.Tests.csproj
@@ -1,7 +1,7 @@
- netcoreapp3.1
+ net6.0
false
@@ -18,9 +18,10 @@
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive