Files
DodoSSH/tests/DodoSSH.Client.App.Layout.Tests/DevicePinWindowTests.cs
T
jaap-jan 0e8fe4fc80 Give each profile its own device key, and make the Linux PIN window able to open at all
- The Windows CNG key and the macOS keychain tag were one name for every profile, so signing out of
  the nightly deleted the key the release build's device unlock was sealed to. DeviceKeyNames keeps the
  existing name for the default profile and gives every other profile its own; sign-out deletes only
  its own key, and a profile sealed before this keeps reading the shared one.
- DevicePinWindow named two palette resources that do not exist and loaded itself with
  AvaloniaXamlLoader.Load, which never assigns the named fields, so it threw on construction and no
  PIN prompt was ever shown. A layout test now builds it against the real palette.
2026-10-02 13:16:48 +02:00

40 lines
1.3 KiB
C#

using DodoSSH.Client.App.Views;
namespace DodoSSH.Client.App.Layout.Tests;
/// <summary>
/// The Linux device-key PIN window, which no other test constructs.
/// </summary>
/// <remarks>
/// It named two palette resources that have never existed, <c>Surface</c> and <c>MutedText</c>, and a
/// <c>StaticResource</c> that cannot be found throws when the window is built — so on the one platform that
/// shows it, registering or unlocking with the TPM failed before any PIN was asked for. Only constructing it
/// against the real palette can catch that, which is what the harness's application provides.
/// </remarks>
public sealed class DevicePinWindowTests
{
private static CancellationToken Token => TestContext.Current.CancellationToken;
[Fact]
public async Task TheWindowBuildsAgainstThePalette()
{
await LayoutHarness.OnTheUiThreadAsync(
() =>
{
var window = new DevicePinWindow();
try
{
LayoutHarness.Settle(window, window.Width, 240);
LayoutHarness.Unreachable(window).ShouldBeEmpty();
}
finally
{
window.Close();
}
},
Token);
}
}