예제 #1
0
 public void when_run_suspicious_class_in_sandbox_throws_expected_SecurityException()
 {
     try
     {
         DefaultSandboxBuilder
         .buildFor <MaliciousTestClass>()
         .create(instance =>
         {
             int result = instance.someMethod(34);
             Assert.Fail($"Expected {nameof(SecurityException)}");
         });
     }
     catch (SecurityException)
     {
     }
 }
예제 #2
0
 public void when_run_suspicious_code_in_sanbox_throws_expected_SecurityExpection()
 {
     try
     {
         DefaultSandboxBuilder
         .buildFor <MethodInvoker>()
         .create(instance =>
         {
             int result = instance.run(prv_suspiciousCode);
             Assert.Fail($"Expected {nameof(SecurityException)}");
         });
     }
     catch (SecurityException)
     {
     }
 }