From eb45aa189a323338c6a6e4ae0b8ad862ddf0dea2 Mon Sep 17 00:00:00 2001 From: Falcon <12919280+falconfly@user.noreply.gitee.com> Date: Tue, 27 Aug 2024 10:52:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9ENugetPluginTest=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Falcon.SugarApi.sln | 8 ++++++- NugetPluginTest/NugetPluginTest.csproj | 28 +++++++++++++++++++++++ NugetPluginTest/Readme.md | 3 +++ NugetPluginTest/Test1.cs | 31 ++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 NugetPluginTest/NugetPluginTest.csproj create mode 100644 NugetPluginTest/Readme.md create mode 100644 NugetPluginTest/Test1.cs diff --git a/Falcon.SugarApi.sln b/Falcon.SugarApi.sln index 5af0a17..d482c54 100644 --- a/Falcon.SugarApi.sln +++ b/Falcon.SugarApi.sln @@ -19,7 +19,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Falcon.SugarApi.Windows", " EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RabbitMqTest", "RabbitMqTest\RabbitMqTest.csproj", "{7F308FE9-B5C5-45BA-B882-15B4B983C39C}" 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 Global 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}.Release|Any CPU.ActiveCfg = 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 GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/NugetPluginTest/NugetPluginTest.csproj b/NugetPluginTest/NugetPluginTest.csproj new file mode 100644 index 0000000..183f515 --- /dev/null +++ b/NugetPluginTest/NugetPluginTest.csproj @@ -0,0 +1,28 @@ + + + + net6.0 + enable + enable + + false + + + + + + + + + + + + + + + + Always + + + + diff --git a/NugetPluginTest/Readme.md b/NugetPluginTest/Readme.md new file mode 100644 index 0000000..e8f9c74 --- /dev/null +++ b/NugetPluginTest/Readme.md @@ -0,0 +1,3 @@ +## ²âÊÔ²å¼þÒÔnuget°üµÄÐÎʽÌṩ + +°üÀ¨²å¼þ°²×°£¬Ð¶ÔØ£¬Éý¼¶²Ù×÷ diff --git a/NugetPluginTest/Test1.cs b/NugetPluginTest/Test1.cs new file mode 100644 index 0000000..6abe0b4 --- /dev/null +++ b/NugetPluginTest/Test1.cs @@ -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); + + } + } +}