/// <summary>
        /// Initializes a new instance of the <see cref="PolicyInjectionBehavior"/> with the given information
        /// about what's being intercepted and the current set of injection policies.
        /// </summary>
        /// <param name="interceptionRequest">Information about what will be injected.</param>
        /// <param name="policies">Current injection policies.</param>
        /// <param name="container">Unity container that can be used to resolve call handlers.</param>
        public PolicyInjectionBehavior(CurrentInterceptionRequest interceptionRequest, InjectionPolicy[] policies,
            IUnityContainer container)
        {
            var allPolicies = new PolicySet(policies);
            bool hasHandlers = false;

            var manager = new PipelineManager();

            foreach (MethodImplementationInfo method in
                interceptionRequest.Interceptor.GetInterceptableMethods(
                    interceptionRequest.TypeToIntercept, interceptionRequest.ImplementationType))
            {
                bool hasNewHandlers = manager.InitializePipeline(method,
                    allPolicies.GetHandlersFor(method, container));
                hasHandlers = hasHandlers || hasNewHandlers;
            }
            pipelineManager = hasHandlers ? manager : null;
        }
        /// <summary>
        /// Intercepts an exported value.
        /// </summary>
        /// <param name="value">The value to be intercepted.</param>
        /// <returns>Intercepted value.</returns>
        public object Intercept(object value)
        {
            var interfaces = value.GetType().GetInterfaces();
            var proxyInterface = interfaces.FirstOrDefault();
            var additionalInterfaces = interfaces.Skip(1).ToArray();

            CurrentInterceptionRequest request = new CurrentInterceptionRequest(interceptor, proxyInterface, value.GetType());
            InjectionPolicy[] policies = new InjectionPolicy[] { new AttributeDrivenPolicy() };
            PolicyInjectionBehavior behaviour = new PolicyInjectionBehavior(request, policies, null);

            var proxy = Microsoft.Practices.Unity.InterceptionExtension.Intercept.ThroughProxyWithAdditionalInterfaces(
                    proxyInterface,
                    value,
                    interceptor,
                    new[] { behaviour },
                    additionalInterfaces);

            return proxy;
        }