From 98da7e789e56b218bb622a0666eab900e094e756 Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Fri, 8 Aug 2014 15:18:07 +0200 Subject: [PATCH] Make sure UpdateManager can do clean installs --- test/UpdateManagerTests.cs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/test/UpdateManagerTests.cs b/test/UpdateManagerTests.cs index 0caf448a..b2832679 100644 --- a/test/UpdateManagerTests.cs +++ b/test/UpdateManagerTests.cs @@ -40,6 +40,37 @@ namespace Squirrel.Tests } } + [Fact] + public async Task InitialInstallSmokeTest() + { + string tempDir; + using (Utility.WithTempDirectory(out tempDir)) { + var remotePackageDir = Directory.CreateDirectory(Path.Combine(tempDir, "remotePackages")); + var localAppDir = Path.Combine(tempDir, "theApp"); + + new[] { + "Squirrel.Core.1.0.0.0-full.nupkg", + }.ForEach(x => File.Copy(IntegrationTestHelper.GetPath("fixtures", x), Path.Combine(remotePackageDir.FullName, x))); + + using (var fixture = new UpdateManager(remotePackageDir.FullName, "theApp", FrameworkVersion.Net45, tempDir)) { + var updateInfo = await fixture.CheckForUpdate(); + await fixture.DownloadReleases(updateInfo.ReleasesToApply); + await fixture.ApplyReleases(updateInfo); + } + + var releasePath = Path.Combine(localAppDir, "packages", "RELEASES"); + File.Exists(releasePath).ShouldBeTrue(); + + var entries = ReleaseEntry.ParseReleaseFile(File.ReadAllText(releasePath, Encoding.UTF8)); + entries.Count().ShouldEqual(1); + + new[] { + "ReactiveUI.dll", + "NSync.Core.dll", + }.ForEach(x => File.Exists(Path.Combine(localAppDir, "app-1.0.0.0", x)).ShouldBeTrue()); + } + } + [Fact] public async Task WhenBothFilesAreInSyncNoUpdatesAreApplied() {