Hello, we recently started to write Unittests for our Web-Application (with nUnit), also introducing TypeMock (V 4.1). For security reasons our application uses the Microsoft AntiXss library, quite often the EncodeUrl-Method. Unfortunately if one of these Methods is called with TypeMock we get an SecurityException:
System.Security.SecurityException: That assembly does not allow partially trusted callers.
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at Microsoft.Security.Application.AntiXss.UrlEncode(String s)
at BetAndWin.SportsBook.Web.components.FlashParameterHandler.AddParameter(String key, String value) in FlashParameter.cs:line 24
at BetAndWin.SportsBook.Web.UnitTest.Components.FlashParameterTest.TestGetParametersAndFlushWith1AddParameter() in FlashParameterTest.cs:line 52
Of course this makes sense since the AntiXss-library seems to protect itself, on the other hand we would like to test the functions as well. Is there a way around this problem, for instance by changing the code access security of our test library?
Thanks for any help,
Alex.