Try() public method

public Try ( System.Action action ) : void
action System.Action
return void
示例#1
0
 public void Will_execute_separate_scopes()
 {
     var scope1 = false;
     var scope2 = false;
     var scope = new SingleScopeOnly();
     scope.Try(() => { scope1 = true; });
     scope.Try(() => { scope2 = true; });
     Assert.That(scope2);
     Assert.That(scope1);
 }
示例#2
0
 public void Will_only_execute_the_first_scope()
 {
     var scope1 = false;
     var scope2 = false;
     var scope = new SingleScopeOnly();
     scope.Try(() => {
         scope.Try(() => {
             scope2 = true;
         });
         scope1 = true;
     });
     Assert.That(!scope2);
     Assert.That(scope1);
 }