Skip to content

[Repo Assist] test: add comprehensive xUnit test project covering all AppSettings propertiesΒ #124

Closed as not planned

Description

@github-actions

πŸ€– This is an automated contribution from Repo Assist.

Summary

Adds a WindowsEdgeLight.Tests xUnit project that comprehensively tests all 8 properties of AppSettings. Previous test branches only covered ExcludeFromCapture β€” this branch covers the complete property set including the newer Brightness, ColorTemperature, IsLightOn, and UI-visibility properties.

Changes

  • WindowsEdgeLight.Tests/WindowsEdgeLight.Tests.csproj β€” new test project (net8.0, xUnit 2.9.2); links AppSettings.cs directly (no WPF dependency)
  • WindowsEdgeLight.Tests/AppSettingsTests.cs β€” 32 tests
  • WindowsEdgeLight/AppSettings.cs β€” SettingsFilePath changed from private static readonly β†’ internal static for test isolation; add InternalsVisibleTo("WindowsEdgeLight.Tests")
  • WindowsEdgeLight.sln β€” test project added to solution

Test Coverage (32 tests, all green)

Area Tests
Default values for all 8 properties 2
Boolean round-trips (ExcludeFromCapture, IsLightOn, Show* Γ—4) 6
Double round-trips with [Theory] β€” Brightness (4 values) 4
Double round-trips with [Theory] β€” ColorTemperature (4 values) 4
All-properties-together round-trip 1
File creation & directory auto-creation 3
Error recovery: corrupted / empty / null JSON 4
Forward-compatibility (unknown JSON properties) 1
JSON format tolerance (trailing commas, comments) 2
Consistency / idempotency 3
Sub-total 32

Why the AppSettings.cs modification is safe

Changing private static readonly string β†’ internal static string is semantically equivalent for production code (no callers outside the class modify it). The internal accessor is only used in tests, guarded by InternalsVisibleTo.

Test Status

Passed!  - Failed: 0, Passed: 32, Skipped: 0, Total: 32

Tested on Linux (net8.0). No Windows or WPF required.

Closes (partially) the test-coverage gap highlighted in the monthly activity issue.

Note

πŸ”’ Integrity filter blocked 1 item

The following item were blocked because they don't meet the GitHub integrity level.

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

Generated by Repo Assist Β· ● 3.5M Β· β—·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@cbb46ab386962aa371045839fc9998ee4e97ca64

Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch repo-assist/test-appsettings-allprops-2026-07-09-1ca9e945d425148c.

Click here to create the pull request

To fix the permissions issue, go to Settings β†’ Actions β†’ General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (488 of 488 lines)
From 7087ee304f0c9bdceb2203ab99fa7b4783d3b8ea Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Thu, 9 Jul 2026 01:24:11 +0000
Subject: [PATCH] test: add comprehensive xUnit test project for AppSettings
 (32 tests, all green)

- Add WindowsEdgeLight.Tests project targeting net8.0
- Link AppSettings.cs as compiled source (no WPF/WinForms dependency)
- 32 tests covering all 8 AppSettings properties:
  - ExcludeFromCapture, IsLightOn, Brightness, ColorTemperature
  - ShowToggleButton, ShowBrightnessButtons, ShowColorTempButtons, ShowMonitorControlButtons
- Tests: defaults, round-trip (all properties), all-properties-together,
  file creation, error recovery (corrupted/empty/null JSON),
  forward-compatibility, JSON format tolerance (comments, trailing commas),
  consistency and idempotency
- Make AppSettings.SettingsFilePath internal (non-readonly) for test isolation
- Add InternalsVisibleTo for test project

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 WindowsEdgeLight.Tests/AppSettingsTests.cs    | 344 ++++++++++++++++++
 .../WindowsEdgeLight.Tests.csproj             |  24 ++
 WindowsEdgeLight.sln                          |  27 ++
 WindowsEdgeLight/AppSettings.cs               |   6 +-
 4 files changed, 400 insertions(+), 1 deletion(-)
 create mode 100644 WindowsEdgeLight.Tests/AppSettingsTests.cs
 create mode 100644 WindowsEdgeLight.Tests/WindowsEdgeLight.Tests.csproj

diff --git a/WindowsEdgeLight.Tests/AppSettingsTests.cs b/WindowsEdgeLight.Tests/AppSettingsTests.cs
new file mode 100644
index 0000000..55208ba
--- /dev/null
+++ b/WindowsEdgeLight.Tests/AppSettingsTests.cs
@@ -0,0 +1,344 @@
+using System;
+using System.IO;
+using System.Text.Json;
+using Xunit;
+
+namespace WindowsEdgeLight.Tests;
+
+/// <summary>
+/// All AppSettings tests run serially to safely override the static SettingsFilePath.
+/// </summary>
+[Collection("AppSettings")]
+public class AppSettingsTests : IDisp
... (truncated)

Activity

  1. shanselman commented on Aug 8, 2026

    @shanselman
    Owner

    Superseded by the smaller successful test proposal in #160.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions