private static bool HandlerIsMatchForException(IPolicyViolationHandler handler, string policyName) { var expectedHandlerName = "{0}ViolationHandler".FormatWith(policyName); var actualHandlerName = handler.GetType().Name; return(expectedHandlerName == actualHandlerName); }
private static bool HandlerIsMatchForPolicyName(IPolicyViolationHandler handler, PolicyViolationException exception) { var expectedHandlerName = "{0}ViolationHandler".FormatWith(exception.PolicyType.Name); var actualHandlerName = handler.GetType().Name; return(expectedHandlerName == actualHandlerName); }
public IPolicyViolationHandler FindHandlerFor(PolicyViolationException exception) { IPolicyViolationHandler matchingHandler = null; foreach (var convention in _conventions) { matchingHandler = convention.GetHandlerFor(exception); if (matchingHandler != null) { break; } } return(matchingHandler); }
public IPolicyViolationHandler FindHandlerFor(PolicyViolationException exception) { IPolicyViolationHandler matchingHandler = null; foreach (var violationHandlerConvention in _conventions) { var convention = violationHandlerConvention; Publish.RuntimeEvent(() => { var conventionName = convention.ToString(); return("Finding policy violation handler using convention {0}.".FormatWith(conventionName)); }, exception.SecurityContext); matchingHandler = convention.GetHandlerFor(exception); if (matchingHandler != null) { Publish.RuntimeEvent(() => "Found policy violation handler {0}.".FormatWith(matchingHandler.GetType().FullName), exception.SecurityContext); break; } } return(matchingHandler); }
private static bool HandlerIsMatchForException(IPolicyViolationHandler handler, PolicyViolationException exception) { var expectedHandlerName = "{0}ViolationHandler".FormatWith(exception.PolicyType.Name); var actualHandlerName = handler.GetType().Name; return expectedHandlerName == actualHandlerName; }
private static bool HandlerIsDefaultPolicyViolationHandler(IPolicyViolationHandler handler) { var actualHandlerName = handler.GetType().Name; return(actualHandlerName == "DefaultPolicyViolationHandler"); }
public MockConvention(IPolicyViolationHandler handlerToReturn = null) { _handlerToReturn = handlerToReturn; }
private static bool HandlerIsDefaultPolicyViolationHandler(IPolicyViolationHandler handler) { var actualHandlerName = handler.GetType().Name; return actualHandlerName == "DefaultPolicyViolationHandler"; }