'Run NUnit test case with Admin Privileges
I have an NUnit test case that modifies the registry key values. That requires admin privileges.
How to run a particular test case or the whole NUnit project with Admin privileges? I tried adding app.manifest to NUnit project with below setting, but it didn't work.
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
Edit: I need admin privileges for my unittest because, in my unittest I am trying to edit a reg key. When I am doing it without Admin privileges, I am getting security exception.
RegistryKey overrides = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Policies\\Microsoft\\<key>", true);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
