新增NugetPluginTest测试
This commit is contained in:
parent
1f46efcce1
commit
eb45aa189a
|
@ -19,7 +19,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Falcon.SugarApi.Windows", "
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RabbitMqTest", "RabbitMqTest\RabbitMqTest.csproj", "{7F308FE9-B5C5-45BA-B882-15B4B983C39C}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RabbitMqTest", "RabbitMqTest\RabbitMqTest.csproj", "{7F308FE9-B5C5-45BA-B882-15B4B983C39C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpTest", "CSharpTest\CSharpTest.csproj", "{FA6A7A47-7EEE-4264-9C89-C2E717B1CB78}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpTest", "CSharpTest\CSharpTest.csproj", "{FA6A7A47-7EEE-4264-9C89-C2E717B1CB78}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NugetPluginTest", "NugetPluginTest\NugetPluginTest.csproj", "{3570FDA6-C408-4A61-852E-3B4F1DCAD1AD}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -51,6 +53,10 @@ Global
|
||||||
{FA6A7A47-7EEE-4264-9C89-C2E717B1CB78}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{FA6A7A47-7EEE-4264-9C89-C2E717B1CB78}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{FA6A7A47-7EEE-4264-9C89-C2E717B1CB78}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{FA6A7A47-7EEE-4264-9C89-C2E717B1CB78}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{FA6A7A47-7EEE-4264-9C89-C2E717B1CB78}.Release|Any CPU.Build.0 = Release|Any CPU
|
{FA6A7A47-7EEE-4264-9C89-C2E717B1CB78}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{3570FDA6-C408-4A61-852E-3B4F1DCAD1AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3570FDA6-C408-4A61-852E-3B4F1DCAD1AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3570FDA6-C408-4A61-852E-3B4F1DCAD1AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{3570FDA6-C408-4A61-852E-3B4F1DCAD1AD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
28
NugetPluginTest/NugetPluginTest.csproj
Normal file
28
NugetPluginTest/NugetPluginTest.csproj
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
||||||
|
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
|
||||||
|
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
|
||||||
|
<PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Nuget\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="Falcon.SugarApi.2.2.0.nupkg">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
3
NugetPluginTest/Readme.md
Normal file
3
NugetPluginTest/Readme.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
## 测试插件以nuget包的形式提供
|
||||||
|
|
||||||
|
包括插件安装,卸载,升级操作
|
31
NugetPluginTest/Test1.cs
Normal file
31
NugetPluginTest/Test1.cs
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO.Compression;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace NugetPluginTest
|
||||||
|
{
|
||||||
|
[TestClass]
|
||||||
|
public class Test1
|
||||||
|
{
|
||||||
|
public string BasePath { get => AppDomain.CurrentDomain.BaseDirectory; }
|
||||||
|
public string NugetName { get => Path.Combine(BasePath,"Falcon.SugarApi.2.2.0.nupkg"); }
|
||||||
|
|
||||||
|
[TestMethod("nuget包解压测试")]
|
||||||
|
public void ExtractNugetTest() {
|
||||||
|
var extractPath = Path.Combine(BasePath,"ent");
|
||||||
|
if(Directory.Exists(extractPath)) {
|
||||||
|
Directory.Delete(extractPath,true);
|
||||||
|
}
|
||||||
|
Directory.CreateDirectory(extractPath);
|
||||||
|
using var packageStream = new FileStream(NugetName,FileMode.Open,FileAccess.Read);
|
||||||
|
using var archive = new ZipArchive(packageStream,ZipArchiveMode.Read);
|
||||||
|
archive.ExtractToDirectory(extractPath);
|
||||||
|
Assert.IsTrue(Directory.GetFiles(extractPath).Length > 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user