Public Access
Desktop: call device unlock what this platform calls it, not Windows Hello everywhere
This commit is contained in:
1 parent
079914bfb4
commit
a6d3924e0d
6 files changed
+161
-10
No files matched your search
@@ -0,0 +1,64 @@
|
||||
using DodoSSH.Client.Shell.ViewModels;
|
||||
|
||||
namespace DodoSSH.Client.App.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// That unlocking with the device key is described in the words of the platform it runs on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The unlock card offered "USE WINDOWS HELLO" on a Mac and the settings page told a Linux machine it needed a
|
||||
/// Windows keystore. Each platform's wording is checked for every other platform's names, because that is the
|
||||
/// mistake: a sentence borrowed from the one platform the feature was written on first.
|
||||
/// </remarks>
|
||||
public sealed class DeviceUnlockWordingTests
|
||||
{
|
||||
public static TheoryData<string> Platforms => ["Windows", "Mac", "Linux", "Android"];
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(Platforms))]
|
||||
public void EachPlatform_NamesOnlyItsOwnGesture(string platform)
|
||||
{
|
||||
var wording = For(platform);
|
||||
|
||||
var foreign = new Dictionary<string, string[]>(StringComparer.Ordinal)
|
||||
{
|
||||
["Windows"] = ["Touch ID", "Secure Enclave", "fingerprint", "PIN"],
|
||||
["Mac"] = ["Windows", "TPM", "fingerprint", "PIN"],
|
||||
["Linux"] = ["Windows", "Touch ID", "Secure Enclave", "fingerprint"],
|
||||
["Android"] = ["Windows", "TPM", "Touch ID", "Secure Enclave"],
|
||||
}[platform];
|
||||
|
||||
string[] said =
|
||||
[wording.Name, wording.Button, wording.Wait, wording.Offer, wording.Registered, wording.Unavailable, wording.Tip];
|
||||
|
||||
foreach (var sentence in said)
|
||||
{
|
||||
sentence.ShouldNotBeNullOrWhiteSpace();
|
||||
|
||||
foreach (var name in foreign)
|
||||
{
|
||||
sentence.ShouldNotContain(name, Case.Sensitive, $"{platform}: \"{sentence}\"");
|
||||
}
|
||||
}
|
||||
|
||||
wording.Button.ShouldBe(wording.Button.ToUpperInvariant(), "every button on these screens is in capitals");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheWordingInUse_IsThisMachines()
|
||||
{
|
||||
var expected = OperatingSystem.IsMacOS() ? DeviceUnlockWording.Mac
|
||||
: OperatingSystem.IsLinux() ? DeviceUnlockWording.Linux
|
||||
: DeviceUnlockWording.Windows;
|
||||
|
||||
DeviceUnlockWording.ForThisPlatform.ShouldBeSameAs(expected);
|
||||
}
|
||||
|
||||
private static DeviceUnlockWording For(string platform) => platform switch
|
||||
{
|
||||
"Windows" => DeviceUnlockWording.Windows,
|
||||
"Mac" => DeviceUnlockWording.Mac,
|
||||
"Linux" => DeviceUnlockWording.Linux,
|
||||
_ => DeviceUnlockWording.Android,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user