Clean assets between test runs

This commit is contained in:
Caelan Sayler
2025-05-18 23:33:30 +01:00
committed by Caelan
parent 552980bab5
commit 5f58fa59e3

View File

@@ -150,18 +150,18 @@ public class UpdateManagerTests
using var logger = _output.BuildLoggerFor<UpdateManagerTests>(); using var logger = _output.BuildLoggerFor<UpdateManagerTests>();
using var _1 = TempUtil.GetTempDirectory(out var packagesPath); using var _1 = TempUtil.GetTempDirectory(out var packagesPath);
using var _2 = TempUtil.GetTempDirectory(out var feedPath); using var _2 = TempUtil.GetTempDirectory(out var feedPath);
var locator = new TestVelopackLocator("MyCoolApp", "1.0.0", packagesPath, logger.ToVelopackLogger()); var locator = new TestVelopackLocator("MyCoolApp", "1.0.0", packagesPath, logger.ToVelopackLogger());
File.Copy(PathHelper.GetFixture("testfeed.json"), Path.Combine(feedPath, "releases.beta.json"), true); File.Copy(PathHelper.GetFixture("testfeed.json"), Path.Combine(feedPath, "releases.beta.json"), true);
File.Copy(PathHelper.GetFixture("AvaloniaCrossPlat-1.0.11-win-full.nupkg"), Path.Combine(feedPath, "AvaloniaCrossPlat-1.0.11-full.nupkg"), true); File.Copy(PathHelper.GetFixture("AvaloniaCrossPlat-1.0.11-win-full.nupkg"), Path.Combine(feedPath, "AvaloniaCrossPlat-1.0.11-full.nupkg"), true);
var options = new UpdateOptions() { var options = new UpdateOptions() {
ExplicitChannel = "beta", ExplicitChannel = "beta",
AllowVersionDowngrade = false, AllowVersionDowngrade = false,
MaximumDeltasBeforeFallback = 10, MaximumDeltasBeforeFallback = 10,
}; };
var um = new UpdateManager(feedPath, options, locator); var um = new UpdateManager(feedPath, options, locator);
var updateInfo = um.CheckForUpdates(); var updateInfo = um.CheckForUpdates();
Assert.NotNull(updateInfo); Assert.NotNull(updateInfo);
@@ -376,6 +376,8 @@ public class UpdateManagerTests
info.TargetFullRelease.SHA256 = null; info.TargetFullRelease.SHA256 = null;
um.DownloadUpdates(info); um.DownloadUpdates(info);
Directory.EnumerateFiles(packagesDir, "*.nupkg", SearchOption.TopDirectoryOnly).ForEach(File.Delete);
// change hash, it should now fail // change hash, it should now fail
string actualHash = info.TargetFullRelease.SHA1; string actualHash = info.TargetFullRelease.SHA1;
string modifiedHash = info.TargetFullRelease.SHA1.Substring(1) + "A"; string modifiedHash = info.TargetFullRelease.SHA1.Substring(1) + "A";