2021.1109 新增net6.0支持
智能大石头 authored at 2021-11-09 08:19:25
812.00 B
X
using System;
using System.IO;
using System.Net.Http;
using NewLife;
using NewLife.Http;
using NewLife.Log;
using NewLife.Net;
using Xunit;

namespace XUnitTest.Net
{
    public class UpgradeTests
    {
        [Fact]
        public void CopyAndReplace()
        {
            //Directory.Delete("./Update", true);

            var url = "http://x.newlifex.com/star/staragent50.zip";
            var fileName = Path.GetFileName(url);
            //fileName = "Update".CombinePath(fileName).EnsureDirectory(true);

            var ug = new Upgrade { Log = XTrace.Log };
            ug.Download(url, fileName);

            // 解压
            var source = ug.Extract(ug.SourceFile);

            // 覆盖
            var dest = "./updateTest";
            ug.CopyAndReplace(source, dest);
        }
    }
}