Repository navigation
Description
π€ This pull request was created by Repo Assist, an automated AI assistant.
Summary
Adds a WindowsEdgeLight.Tests xUnit project (targeting net8.0) with 37 tests covering AppSettings serialization behaviour. No WPF/WinForms dependencies β the test project compiles and runs on Linux CI.
What was changed
AppSettings.cs
- Extracted
internal static AppSettings LoadFrom(string path)andinternal void SaveTo(string path)overloads so tests can work with a temp file instead of the real AppData folder. - The public
Load()/Save()methods simply delegate to these overloads β no behaviour change. - Promoted
JsonSerializerOptionstostatic readonlyfields to avoid allocating new instances on every call (minor perf improvement as a by-product).
WindowsEdgeLight.Tests/
New project with 37 xUnit tests across these categories:
| Category | Tests |
|---|---|
| Default property values (all 8 fields) | 8 |
LoadFrom β missing file β defaults |
1 |
LoadFrom β empty JSON ({}) β defaults |
1 |
LoadFrom β partial JSON (missing keys use defaults) |
1 |
LoadFrom β corrupted JSON β defaults + file deleted |
2 |
LoadFrom β trailing comma / // comment tolerated |
2 |
Round-trip SaveTo/LoadFrom all bool flags (Γ2 each) |
12 |
Round-trip Brightness boundary values |
3 |
Round-trip ColorTemperature boundary values |
3 |
| Round-trip all 8 properties together | 1 |
SaveTo creates intermediate directories |
1 |
SaveTo writes valid JSON (verified with JsonDocument) |
1 |
SaveTo overwrites existing file |
1 |
WindowsEdgeLight.sln
Test project added to the solution.
Test Status
Test Run Successful.
Total tests: 37
Passed: 37
Total time: 2.3 Seconds
All 37 tests pass on net8.0 / Linux (dotnet 10.0.301).
Note
π Integrity filter blocked 1 item
The following item were blocked because they don't meet the GitHub integrity level.
- Detect camera is being used by another application and automatically turn onΒ #21
list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
To allow these resources, lower min-integrity in your GitHub frontmatter:
tools:
github:
min-integrity: approved # merged | approved | unapproved | noneGenerated by Repo Assist Β· β 2M Β· β·
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-v2-2026-07-15-857e1104ec5cd3a0.
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 (500 of 553 lines)
From e28ce78408156915858dff0fc3d71887b37d9a53 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Wed, 15 Jul 2026 13:16:18 +0000
Subject: [PATCH] test: add xUnit test project for AppSettings (37 tests)
Add WindowsEdgeLight.Tests project (net8.0/xUnit) with 37 tests covering:
- Default property values for all 8 settings fields
- Round-trip SaveTo/LoadFrom for all bool and double properties
- LoadFrom on missing file returns defaults
- Corrupted JSON gracefully falls back to defaults and deletes corrupt file
- Empty JSON ({}) returns defaults
- Partial JSON (only some keys) preserves defaults for missing keys
- JSON with trailing commas and // comments parses successfully
- SaveTo creates intermediate directories if missing
- SaveTo overwrites existing file correctly
AppSettings.cs is refactored to expose internal LoadFrom(path)/SaveTo(path)
overloads, making it testable without touching AppData. The public Load()/Save()
methods delegate to these overloads. Static JsonSerializerOptions instances
avoid repeated allocations on every call.
Test Status: 37/37 passed (dotnet test, net8.0)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
WindowsEdgeLight.Tests/AppSettingsTests.cs | 323 ++++++++++++++++++
.../WindowsEdgeLight.Tests.csproj | 33 ++
WindowsEdgeLight.sln | 27 ++
WindowsEdgeLight/AppSettings.cs | 55 +--
4 files changed, 415 insertions(+), 23 deletions(-)
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..4f47f38
--- /dev/null
+++ b/WindowsEdgeLight.Tests/AppSettingsTests.cs
@@ -0,0 +1,323 @@
+using System.IO;
+using System.Text.Json;
+using Xunit;
+
+namespace WindowsEdgeLight.Tests;
+
+/// <summary>
+
... (truncated)
Activity
github-actions commentedon Jul 27, 2026
π€ This is an automated update from Repo Assist.
Testing improvement prepared (2026-07-27): The test branch has been extended locally with 13 additional tests and a bug fix:
Bug fix in
AppSettings.cs:LoadFrom()now clampsBrightnessto the documented range[0.2, 1.0]andColorTemperatureto[0.0, 1.0]. Without this, a hand-edited or corrupted settings file could produce out-of-range values at runtime.13 new tests added:
LoadFrom_OutOfRangeBrightness_IsClampedToValidRange(5 theory cases: -1.0β0.2, 0.0β0.2, 0.19β0.2, 1.01β1.0, 2.0β1.0)LoadFrom_OutOfRangeColorTemperature_IsClampedToValidRange(4 theory cases)LoadFrom_BrightnessAtMinimumBoundary_IsUnchangedβ 0.2 is preservedLoadFrom_BrightnessAtMaximumBoundary_IsUnchangedβ 1.0 is preservedLoadFrom_ColorTemperatureAtMinimumBoundary_IsUnchangedβ 0.0 is preservedLoadFrom_ColorTemperatureAtMaximumBoundary_IsUnchangedβ 1.0 is preservedTest results: 50/50 passing (was 37/37; all 13 new tests pass)
The clamping fix is also applicable directly to the
masterbranch'sAppSettings.cs(theLoadFrominternal overload needs the twoMath.Clamplines, but the same logic should be added to the existingLoad()method on master).Note
π Integrity filter blocked 2 items
The following items were blocked because they don't meet the GitHub integrity level.
list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter:shanselman commentedon Aug 8, 2026
Superseded by the smaller successful test proposal in #160.