Skip to content

[Enhancement]: Tests — one guard is right by accident, and two failure paths have no test #2618

Description

@laurentiu021

Problem

  • The README's status-line count. ArchitectureTests checks the README's "announced on all 53 tabs that have one" by counting Text="{Binding StatusMessage}" plus <v:StatusFooter/> across Views/*.xaml (ArchitectureTests.cs:6002-6006). That counts StatusFooter.xaml's own TextBlock, which is not a tab, and misses Large Files' status line, which binds ScanStatus (Views/LargeFilesView.xaml:129). The two errors cancel out today, so the number is right for the wrong reason, and the next change to either breaks it in a confusing way.
  • Restore All's NVIDIA card hand-off. Performance Mode's Restore All passes the card its question found to the restore (RestoreOriginalAsync(snapshot, card)), so the restore does what the question said. No test pins it, because every restore step before the graphics one writes this PC's registry and power settings.
  • Environment Variables' unreadable backup. Services/EnvironmentVariableService.cs turns an IO, security or access failure while reading a safety copy into "unreadable". The tests reach the one case a test can cause, a legacy backup file held open by another handle. The other eight catches (the IO, security and access-denied ones around the User and Machine registry copies, and the legacy file's two access-denied ones) are reached by no test, because a test cannot make those reads fail on demand.

Proposed solution

  • Count tabs, not markup: the guard maps each tab's view to whether it has an announced status line, so the number is the count of tabs.
  • Give PerformanceService's restore steps a seam (the power plan, visual effects, Game Mode and Xbox writers), so a test can run Restore All against substitutes and assert the card it was handed is the one written.
  • Read the safety copies through an injectable reader, so tests can make each read throw each exception type and assert the "unreadable" result.

Affected tab

Tests

Activity

  1. added a commit that references this issue on Oct 9, 2026
    34d650a
  2. laurentiu021 commented on Oct 9, 2026

    @laurentiu021
    OwnerAuthor

    Done in #2662. Tests and test seams only, so it ships with the next release rather than making one.

    Status-line count. EveryReadmeTabCount_MatchesTheSource counts tabs now, from the sidebar: each one whose view shows a line bound to StatusMessage, a line in the StatusLine or SubtleStatusLine style, or the shared footer. It is still 54, for the right reason: with Large Files' line losing its style, main's guard passed and this one fails; with StatusFooter.xaml rebinding its own line, main's guard failed and this one passes.

    Restore All's card. The restore takes its visual effects, Game Mode, Game Bar and graphics writes from the constructor; the public constructor passes the same methods as before, and the test constructor writes nothing unless a test passes its own. A theory runs the whole of Restore All with the card found one way when the question is asked and the other way after it, and checks the setting goes to the card the question promised. Passing no card, or ignoring the one handed over, turns it red.

    Unreadable safety copies. The User and Machine registry copies and the legacy file are opened through two constructor seams, and a theory makes each fail with an IO, a security and an access error: every restore and the safety copy before a change refuse it as unreadable. Disabling any one of the nine catches turns its case red.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttestsTest projects only

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions