Im not sure the best way to do this. I need to write some unit tests that test that certain users have the ability to do certain things; the objects have role based permissions.
The problem is that in order to do this I have to impersonate one of 4 test users to get the permission set that is going to be tested. While impersonating myself is quite easy I cant find any .NET libraries that allow me to create a Windows identity/principal and make the unit test run in the context of that user.
Any ideas would be greatly appreciated. Id prefer not to hit the Windows APIs if possible; if that is the only solution, a pointer to someone who has already wrapped LogonUser or whatever it is (dont remember) would great.
The problem is that in order to do this I have to impersonate one of 4 test users to get the permission set that is going to be tested. While impersonating myself is quite easy I cant find any .NET libraries that allow me to create a Windows identity/principal and make the unit test run in the context of that user.
Any ideas would be greatly appreciated. Id prefer not to hit the Windows APIs if possible; if that is the only solution, a pointer to someone who has already wrapped LogonUser or whatever it is (dont remember) would great.