public void TestCallHandlerCustomFactory() { PolicyInjectionSettings settings = new PolicyInjectionSettings(); PolicyData policyData = new PolicyData("policy"); ExceptionCallHandlerData data = new ExceptionCallHandlerData("exceptionhandler", "Swallow Exceptions"); data.Order = 5; policyData.Handlers.Add(data); policyData.MatchingRules.Add(new CustomMatchingRuleData("matchesEverything", typeof(AlwaysMatchingRule))); settings.Policies.Add(policyData); ExceptionPolicyData swallowExceptions = new ExceptionPolicyData("Swallow Exceptions"); swallowExceptions.ExceptionTypes.Add(new ExceptionTypeData("Exception", typeof(Exception), PostHandlingAction.None)); DictionaryConfigurationSource dictConfigurationSource = new DictionaryConfigurationSource(); IUnityContainer container = new UnityContainer().AddNewExtension<Interception>(); settings.ConfigureContainer(container); container.RegisterInstance("Swallow Exceptions", swallowExceptions.BuildExceptionPolicy()); RuleDrivenPolicy policy = container.Resolve<RuleDrivenPolicy>("policy"); ICallHandler handler = (policy.GetHandlersFor(new MethodImplementationInfo(null, (MethodInfo)MethodBase.GetCurrentMethod()), container)).ElementAt(0); Assert.IsNotNull(handler); Assert.AreEqual(handler.Order, data.Order); }