public void Test() { try { using (var scope = Scope.ForEnforceArgument("Test", Scope.WhenError)) { ScopeTestHelper.FireErrors(scope); } } catch (ArgumentException ex) { ScopeTestHelper.ShouldBeClean(ex); ScopeTestHelper.ShouldHave(ex, "ErrA"); ScopeTestHelper.ShouldNotHave(ex, "ErrB", "ErrC"); throw; } }
public void Test() { var Test = 1; try { using (var t = ScopeFactory.ForEnforce(() => Test, Scope.WhenError)) { ScopeTestHelper.FireErrors(t); } } catch (RuleException ex) { ScopeTestHelper.ShouldBeClean(ex); ScopeTestHelper.ShouldHave(ex, "ErrA"); ScopeTestHelper.ShouldNotHave(ex, "ErrB", "ErrC"); throw; } }