fix.在线安装器,启动器

This commit is contained in:
lincube
2026-06-05 11:08:11 +08:00
parent bb4e90ea8d
commit 8c88e305ee
42 changed files with 1507 additions and 393 deletions

View File

@@ -40,6 +40,8 @@ public sealed class UpdateSettingsInterfaceTests
Assert.Equal(1, update.CheckCalls);
Assert.Equal("1.2.3", viewModel.LatestVersionText);
Assert.True(viewModel.IsDeltaUpdate);
Assert.True(viewModel.CanDownload);
Assert.True(viewModel.IsProgressSectionVisible);
update.SetPhase(UpdatePhase.Checked);
await ((IAsyncRelayCommand)viewModel.DownloadCommand).ExecuteAsync(null);
@@ -62,6 +64,36 @@ public sealed class UpdateSettingsInterfaceTests
Assert.Equal(1, update.CancelCalls);
}
[Fact]
public async Task UpdateSettingsViewModel_WhenCheckFailsInCheckedPhase_DoesNotExposeDownload()
{
var update = new FakeUpdateSettingsService
{
CheckReport = new UpdateCheckReport(
false,
null,
"1.0.0",
null,
null,
null,
null,
null,
null,
"No usable update manifest was found.")
};
var viewModel = new UpdateSettingsViewModel(new FakeSettingsFacade(update));
viewModel.IsUpdateAvailable = true;
viewModel.LatestVersionText = "9.9.9";
await ((IAsyncRelayCommand)viewModel.CheckCommand).ExecuteAsync(null);
Assert.False(viewModel.IsUpdateAvailable);
Assert.Empty(viewModel.LatestVersionText);
Assert.False(viewModel.CanDownload);
Assert.False(viewModel.IsProgressSectionVisible);
Assert.Equal(0, update.DownloadCalls);
}
[Fact]
public void UpdateSettingsViewModel_SavesPreferencesThroughUpdateSettingsService()
{
@@ -140,6 +172,32 @@ public sealed class UpdateSettingsInterfaceTests
Assert.False(orchestratorCreated);
}
[Fact]
public async Task UpdateSettingsService_WhenPlondsCheckFails_ReturnsIdleAndNoDownload()
{
var settings = new FakeSettingsService
{
Snapshot =
{
UpdateDownloadSource = UpdateSettingsValues.DownloadSourcePlonds
}
};
var plonds = new FakePlondsService
{
LatestResult = PlondsLatestResult.Failed(new Version(1, 0, 0), "No usable PLONDS manifest was found.")
};
var service = new UpdateSettingsService(
settings,
orchestratorFactory: () => throw new InvalidOperationException("not used"),
plondsService: plonds);
var report = await service.CheckAsync(CancellationToken.None);
Assert.False(report.IsUpdateAvailable);
Assert.Equal("No usable PLONDS manifest was found.", report.ErrorMessage);
Assert.Equal(UpdatePhase.Idle, service.CurrentPhase);
}
[Fact]
public async Task UpdateSettingsService_WhenPlondsManifestRequiresCleanInstall_ReportsFullInstaller()
{