diff --git a/SysManager/SysManager.Tests/AboutViewModelTests.cs b/SysManager/SysManager.Tests/AboutViewModelTests.cs
index e877da3..3510895 100644
--- a/SysManager/SysManager.Tests/AboutViewModelTests.cs
+++ b/SysManager/SysManager.Tests/AboutViewModelTests.cs
@@ -10,6 +10,15 @@ namespace SysManager.Tests;
public class AboutViewModelTests
{
+ ///
+ /// Builds an AboutViewModel WITHOUT the startup update-check, so default-state
+ /// assertions don't race the constructor's async network fetch (which populates
+ /// UpdateStatus / LatestNotes / LatestVersionLabel / LatestPublishedLabel /
+ /// UpdateAvailable).
+ ///
+ private static AboutViewModel NewVmNoAutoCheck() =>
+ new(new UpdateService(), new SystemReportService(new SystemInfoService(), new DiskHealthService()), autoCheck: false);
+
[Fact]
public void Constructs_WithDefaultService()
{
@@ -50,14 +59,14 @@ public void ReleaseHistory_StartsEmpty()
[Fact]
public void UpdateStatus_HasInitialMessage()
{
- var vm = new AboutViewModel();
+ var vm = NewVmNoAutoCheck();
Assert.False(string.IsNullOrWhiteSpace(vm.UpdateStatus));
}
[Fact]
public void UpdateAvailable_DefaultsFalse()
{
- var vm = new AboutViewModel();
+ var vm = NewVmNoAutoCheck();
Assert.False(vm.UpdateAvailable);
}
@@ -192,21 +201,21 @@ public async Task CheckForUpdatesCommand_NeverThrows()
[Fact]
public void LatestVersionLabel_DefaultsEmpty()
{
- var vm = new AboutViewModel();
+ var vm = NewVmNoAutoCheck();
Assert.Equal(string.Empty, vm.LatestVersionLabel);
}
[Fact]
public void LatestPublishedLabel_DefaultsEmpty()
{
- var vm = new AboutViewModel();
+ var vm = NewVmNoAutoCheck();
Assert.Equal(string.Empty, vm.LatestPublishedLabel);
}
[Fact]
public void LatestNotes_DefaultsEmpty()
{
- var vm = new AboutViewModel();
+ var vm = NewVmNoAutoCheck();
Assert.Equal(string.Empty, vm.LatestNotes);
}
diff --git a/SysManager/SysManager/ViewModels/AboutViewModel.cs b/SysManager/SysManager/ViewModels/AboutViewModel.cs
index 5f2c7e3..b75fdbe 100644
--- a/SysManager/SysManager/ViewModels/AboutViewModel.cs
+++ b/SysManager/SysManager/ViewModels/AboutViewModel.cs
@@ -57,10 +57,20 @@ public sealed partial class AboutViewModel : ViewModelBase
public AboutViewModel() : this(new UpdateService(), new SystemReportService(new SystemInfoService(), new DiskHealthService())) { }
public AboutViewModel(UpdateService updates, SystemReportService reportService)
+ : this(updates, reportService, autoCheck: true) { }
+
+ ///
+ /// Core constructor. controls whether the
+ /// startup update-check (a live network call that populates the update
+ /// properties) runs. Production always passes true; tests pass false to
+ /// assert the constructor's default state without racing the async fetch.
+ ///
+ internal AboutViewModel(UpdateService updates, SystemReportService reportService, bool autoCheck)
{
_updates = updates;
_reportService = reportService;
- InitializeAsync(InitAsync);
+ if (autoCheck)
+ InitializeAsync(InitAsync);
}
private async Task InitAsync()