Hermetic real-MainWindow tests: LayoutPathOverride temp-DB seam (InternalsVisibleTo); fix tests persisting fake webcam sources over the real layout DB; LayoutStore delete-roundtrip guard

This commit is contained in:
2026-08-06 15:16:58 -07:00
parent 7bc70872d9
commit f31ce9fdb7
5 changed files with 90 additions and 2 deletions
+6 -1
View File
@@ -481,7 +481,7 @@ public class MainViewModel : ViewModelBase
SaveLayoutAsCommand = new RelayCommand(_ => SaveLayoutAs());
OpenLayoutCommand = new RelayCommand(_ => OpenLayoutFile());
_layoutStore = new LayoutStore(DefaultLayoutPath);
_layoutStore = new LayoutStore(LayoutPathOverride ?? DefaultLayoutPath);
_activeLayoutPath = _layoutStore.ActivePath;
_cameraEnumerator = new MediaCaptureCameraEnumerator();
@@ -531,6 +531,11 @@ public class MainViewModel : ViewModelBase
"ytLlive",
"ytLlive.db");
// Test seam: a real MainWindow test must never read or write the user's
// real layout DB (it would persist test sources over real ones). Tests set
// this to a temp path before constructing MainWindow and reset it after.
internal static string? LayoutPathOverride { get; set; }
private void LoadLayout()
{
_isLoading = true;