예제 #1
0
        public void ShouldCreateHandlerWithCorrectPolicy()
        {
            string policy = "Swallow Exceptions";
            ExceptionCallHandlerAttribute attribute = new ExceptionCallHandlerAttribute(policy);
            ExceptionCallHandler          handler   = (ExceptionCallHandler)attribute.CreateHandler();

            Assert.AreEqual(policy, handler.ExceptionPolicyName);
        }
        public void ShouldCreateHandlerWithCorrectPolicy()
        {
            string policyName = "Swallow Exceptions";
            ExceptionCallHandlerAttribute attribute = new ExceptionCallHandlerAttribute(policyName);

            attribute.Order = 400;

            IUnityContainer container = new UnityContainer();
            var             policy    = new ExceptionPolicyImpl(policyName, new ExceptionPolicyEntry[0]);

            container.RegisterInstance(policyName, policy);

            ExceptionCallHandler handler = (ExceptionCallHandler)attribute.CreateHandler(container);

            Assert.AreSame(policy, handler.ExceptionPolicy);
            Assert.AreEqual(400, handler.Order);
        }