Files
poli0981andClaude Opus 4.8 6a198872d1 Phase 5c: Home dashboard, favorites, window-state, accessibility
Completes Phase 5 (Polish):
- Home dashboard (default screen): recent commands, pinned favorites,
  and a read-only system-status widget (Windows + build, RAM, system
  drive, uptime) via ISystemInfoService. Status is read locally with
  no process spawn, no elevation and no network (golden rules).
- Favorites: pin/unpin from the list + detail star, persisted by id in
  config.json; a Favorites sidebar item filters the catalog to pins.
- Recent commands: last 10 run command ids tracked for Home.
- Window placement: persist + restore size/position/maximized, clamped
  to the virtual screen so a stale multi-monitor position never lands
  off-screen.
- Accessibility: AutomationProperties.Name on new controls + palette
  and confirmation inputs; heading semantics on Home; Ctrl+H opens Home.

Implementation notes:
- ISystemInfoService uses Environment.OSVersion + CsWin32
  GlobalMemoryStatusEx + DriveInfo + TickCount64 (AllowUnsafeBlocks for
  the generated interop).
- Pure, unit-tested helpers RecentCommands.Add / Favorites.Toggle and
  WindowPlacement.IsOnScreen.
- 102 tests pass; 0-warning Release build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 14:33:48 +07:00

27 lines
917 B
C#

using CommandForge.Infrastructure.SystemInfo;
namespace CommandForge.Tests;
/// <summary>Smoke tests that the read-only system-status snapshot returns plausible values.</summary>
public sealed class SystemInfoTests
{
[Fact]
public void GetStatus_ReturnsPlausibleValues()
{
var status = new WindowsSystemInfoService().GetStatus();
Assert.False(string.IsNullOrWhiteSpace(status.OsName));
Assert.True(status.OsBuild > 0);
Assert.True(status.TotalMemoryBytes > 0);
Assert.True(status.AvailableMemoryBytes > 0);
Assert.True(status.AvailableMemoryBytes <= status.TotalMemoryBytes);
Assert.False(string.IsNullOrWhiteSpace(status.SystemDriveName));
Assert.True(status.SystemDriveTotalBytes > 0);
Assert.InRange(status.SystemDriveFreeBytes, 0, status.SystemDriveTotalBytes);
Assert.True(status.Uptime >= TimeSpan.Zero);
}
}