Hello,
I've made some extensions to xUnit that allow me to run tests under a certain trust level but the problem is that Fluent Assertions uses GetName() in its LateBoundTestFramework class that throw a security exception under medium-trust, the workaround is to use
'AssemblyName(a.FullName).Name' .
It's probably the only thing that needs to change to work under medium trust, I didn't see anything else.
Here is what I'm getting.
System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, ref StackCrawlMark stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Reflection.RuntimeAssembly.VerifyCodeBaseDiscovery(String codeBase)
at System.Reflection.RuntimeAssembly.GetName(Boolean copiedName)
at FluentAssertions.Frameworks.LateBoundTestFramework.<get_IsAvailable>b__0(Assembly a)
at System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source, Func`2 predicate)
at FluentAssertions.Frameworks.LateBoundTestFramework.get_IsAvailable()
at FluentAssertions.Frameworks.AssertionHelper.<AttemptToDetectUsingAssemblyScanning>b__0(ITestFramework framework)
at System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source, Func`2 predicate)
at FluentAssertions.Frameworks.AssertionHelper.AttemptToDetectUsingAssemblyScanning()
at FluentAssertions.Verification.FailWith(String failureMessage, Object[] failureArgs)
at FluentAssertions.Assertions.ActionAssertions.ShouldThrow(String reason, Object[] reasonArgs)
at EasyFront.Framework.Web.Hosting.Packages.PackageFileInfoTest.Copy.Should_throw_exception_in_medium_when_probing_directory_does_not_exist()
↧
New Post: Medium Trust support
↧