32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
|
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);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|