chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
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.
asked by alex.winkler (600 points)

2 Answers

0 votes
Hi Alex,

This is a known issue that we have been working on.
Currently we dont have a work around to this. :(

I will keep you posted as soon as we manage to locate a workaround/fix the problem.
answered by lior (13.2k points)
0 votes
Hi,

The fix for the issue is now part of the Typemock Isolator 4.2.
You can download it from here: https://www.typemock.com/Downloads.php.
The fix is that Typemock Isolator now allows calling from partially trusted assemblies.
answered by gilz (14.5k points)
...