title: How to unit test administrator-only functionality?
body: <p>The design of my application is that standard user operations run first (and produce interested information even if the user cannot proceed) and then optionally offers to make some system changes accordingly, which requires elevation.  If the user chooses to proceed, the program reruns itself requiring elevation with a command line switch that tells it where in the workflow to resume.  The new process then picks back up where the old one left off and makes the changes the user requested.</p>
  
  <p>My problem is I don't know how to write unit tests against the library methods that necessarily make privileged calls without running all of Visual Studio as administrator.  I'd really like to avoid doing that so I'm fine with the system prompting me for credentials to run some or all of my unit tests.  But currently as a standard user, the calls simply fail with the "System.Management.ManagementException: Access denied" exception.</p>
  
  <p>Any ideas or experiences with handling this beyond elevating the whole of Visual Studio for the session?  Since I'm using the built-in unit tests, ideally the solution would still display per-test results in the test results window but that's not a requirement.</p>