title: Skip unit-test if the user is not allowed to do it
body: <p>We are building our unit-tests with Visual Studio 10 integrated MS unit-tests.</p>
  
  <p>Some functions in our application do only work right, if the user that tries to access this function has the right privileges - like being administrator of the computer (or even evaluated administrator (depending on the target system). For example, we are creating new performance counters - for that you do need to be administrator.</p>
  
  <p>Now, I want to test those functions with unit tests. When I start VS as administrator, all is good. But we are also have an automated build system (Jenkins) that runs the unit tests with a normal user.
  The question is, is there a nice way (like a method attribute) to skip tests when the user that runs the unit tests does not have the privileges to run them.</p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>Changing configurations based on target machines does not really satisfy me. I just found the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.testclassextensionattribute.aspx" rel="nofollow">TestClassExtensionAttribute Class</a> and some nice <a href="http://blogs.msdn.com/b/vstsqualitytools/archive/2009/09/04/extending-the-visual-studio-unit-test-type-part-1.aspx" rel="nofollow">tutorial</a> how to implement it. I will try to go that way now, since it is much easier when developing tests.</p>