<p>I want to test the behavior of a certain piece of .NET code in partial trust environments.  What's the fastest way to set this up?  Feel free to assume that I (and other readers) are total CAS noobs.</p>

<p>@Nick: Thanks for the reply.  Alas, the tool in question is explicitly for unmanaged code.  I didn't say "managed" in my question, and should not have assumed that people would infer it from the ".NET" tag.</p>

Use the
Microsoft Application Verifier
.
AppVerifier helps to determine:
When the application is using APIs correctly:
      (Unsafe TerminateThread APIs., Correct use of Thread Local Storage (TLS) APIs.,          o Correct use of virtual space manipulations (for example, VirtualAlloc, MapViewOfFile).
Whether the application is hiding access violations using structured exception handling.
Whether the application is attempting to use invalid handles.
Whether there are memory corruptions or issues in the heap.
Whether the application runs out of memory under low resources.
Whether the correct usage of critical sections is occurring.
Whether an application running in an administrative environment will run well in an environment with less privilege.
Whether there are potential problems when the application is running as a limited user.
Whether there are uninitialized variables in future function calls in a thread's context.