RunAs Restricted
TAEF ensures that the test is run in a restricted process.
Note On computers running versions of Windows older than Windows Vista, you must run restricted tests from an administrator process.
Specifying RunAs on the Command Line
te unittests\* /runas:restricted
Marking Tests with RunAs
Test metadata can be used to specify the runas type of an assembly, class or test method.
Note RunAs values specified in metadata override RunAs values specified on the command line. For example, a test marked with runas:system test metadata will still be run as Local System even if /runas:elevated is specified on the command line.
Example (native code)
class MyTests
{
TEST_CLASS(MyTests);
BEGIN_TEST_METHOD(RestrictedTest)
TEST_METHOD_PROPERTY(L"RunAs", L"Restricted")
END_TEST_METHOD()
};