Check RegistryKey modifications directly in test
MODIFY
WalletWasabi.Tests/UnitTests/StartWasabiOnSystemStartupTests.cs
WalletWasabi.Tests/UnitTests/StartWasabiOnSystemStartupTests.cs
+using Microsoft.Win32;
using System;
using System.IO;
+using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using WalletWasabi.Fluent.Helpers;
@@ -11,6 +13,8 @@ namespace WalletWasabi.Tests.UnitTests
{
public class StartWasabiOnSystemStartupTests
{
+ private const string PathToRegistyKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
+
[Fact]
public async Task ModifyStartupOnDifferentSystemsTestAsync()
{
@@ -19,7 +23,10 @@ namespace WalletWasabi.Tests.UnitTests
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
await StartupHelper.ModifyStartupSettingAsync(true);
+ Assert.True(CheckIfRegistryKeyExist());
+
await StartupHelper.ModifyStartupSettingAsync(false);
+ Assert.False(CheckIfRegistryKeyExist());
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
@@ -44,5 +51,18 @@ namespace WalletWasabi.Tests.UnitTests
return uiConfig;
}
+
+ private bool CheckIfRegistryKeyExist()
+ {
+ bool result = false;
+
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ RegistryKey? registryKey = Registry.CurrentUser.OpenSubKey(PathToRegistyKey, false);
+ result = registryKey.GetValueNames().Contains(nameof(WalletWasabi));
+ }
+
+ return result;
+ }
}
}

Check RegistryKey modifications directly in test