更新Tests项目

develop
old yi 2024-03-27 22:29:15 +08:00
parent f055c08fa1
commit 0750abf8c7
3 changed files with 11 additions and 9 deletions

View File

@ -52,7 +52,7 @@
<PackageReference Include="Microsoft.Graph.Core" Version="1.23.0" /> <PackageReference Include="Microsoft.Graph.Core" Version="1.23.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.9.10" /> <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.9.10" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -22,6 +22,7 @@ using System.Reflection;
using System.Security.Claims; using System.Security.Claims;
using System.Text; using System.Text;
using Xunit; using Xunit;
using Microsoft.Extensions.PlatformAbstractions;
namespace New_College.Tests namespace New_College.Tests
{ {
@ -31,7 +32,7 @@ namespace New_College.Tests
[Fact] [Fact]
public void DI_Connet_Test() public void DI_Connet_Test()
{ {
var basePath = Microsoft.DotNet.PlatformAbstractions.ApplicationEnvironment.ApplicationBasePath; var basePath = PlatformServices.Default.Application.ApplicationBasePath;
IServiceCollection services = new ServiceCollection(); IServiceCollection services = new ServiceCollection();
services.AddAutoMapper(typeof(Startup)); services.AddAutoMapper(typeof(Startup));
@ -43,7 +44,7 @@ namespace New_College.Tests
ConnectionString = GetMainConnectionDb().Connection,//必填, 数据库连接字符串 ConnectionString = GetMainConnectionDb().Connection,//必填, 数据库连接字符串
DbType = (SqlSugar.DbType)GetMainConnectionDb().DbType,//必填, 数据库类型 DbType = (SqlSugar.DbType)GetMainConnectionDb().DbType,//必填, 数据库类型
IsAutoCloseConnection = true,//默认false, 时候知道关闭数据库连接, 设置为true无需使用using或者Close操作 IsAutoCloseConnection = true,//默认false, 时候知道关闭数据库连接, 设置为true无需使用using或者Close操作
IsShardSameThread = true,//共享线程 // sh = true,//共享线程
InitKeyType = SqlSugar.InitKeyType.SystemTable//默认SystemTable, 字段信息读取, 如:该属性是不是主键,标识列等等信息 InitKeyType = SqlSugar.InitKeyType.SystemTable//默认SystemTable, 字段信息读取, 如:该属性是不是主键,标识列等等信息
}); });
}); });
@ -108,7 +109,7 @@ namespace New_College.Tests
public IContainer DICollections() public IContainer DICollections()
{ {
var basePath = Microsoft.DotNet.PlatformAbstractions.ApplicationEnvironment.ApplicationBasePath; var basePath = PlatformServices.Default.Application.ApplicationBasePath;
IServiceCollection services = new ServiceCollection(); IServiceCollection services = new ServiceCollection();
services.AddAutoMapper(typeof(Startup)); services.AddAutoMapper(typeof(Startup));
@ -156,7 +157,7 @@ namespace New_College.Tests
ConnectionString = GetMainConnectionDb().Connection,//必填, 数据库连接字符串 ConnectionString = GetMainConnectionDb().Connection,//必填, 数据库连接字符串
DbType = (SqlSugar.DbType)GetMainConnectionDb().DbType,//必填, 数据库类型 DbType = (SqlSugar.DbType)GetMainConnectionDb().DbType,//必填, 数据库类型
IsAutoCloseConnection = true,//默认false, 时候知道关闭数据库连接, 设置为true无需使用using或者Close操作 IsAutoCloseConnection = true,//默认false, 时候知道关闭数据库连接, 设置为true无需使用using或者Close操作
IsShardSameThread = true,//共享线程 // IsShardSameThread = true,//共享线程
InitKeyType = SqlSugar.InitKeyType.SystemTable//默认SystemTable, 字段信息读取, 如:该属性是不是主键,标识列等等信息 InitKeyType = SqlSugar.InitKeyType.SystemTable//默认SystemTable, 字段信息读取, 如:该属性是不是主键,标识列等等信息
}); });
}); });

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>
@ -18,9 +18,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Moq" Version="4.13.1" /> <PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" />
<PackageReference Include="xunit" Version="2.4.1" /> <PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1"> <PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>