public void ParallelInvokationShouldReuseTheSameAttribute()
        {
            var container = ConfigureUnityContainer();
            container.RegisterType<IDependentService, DependentServiceImpl>( new PerResolveLifetimeManager() );

            var filterProvider = new UnityFilterAttributeFilterProvider( container );

            RegisterFilterAttributeProvider( filterProvider );
            IActionInvoker a = new ActionInvokerExpecter<ActionFilteredResult>();
            ParallelLoopResult result = Parallel.For( 0, 2, ( cpt ) =>
            {
                var controller = container.Resolve<ControllerStub>();
                controller.SetMockControllerContext();
                a.InvokeAction( controller.ControllerContext, "SimpleActionUnityDependent" );
            } );
            Assert.That( result.IsCompleted );
        }
        public void Test_Unity_Filter_Attribute()
        {
            var container = ConfigureUnityContainer();
            container.RegisterType<IDependentService, DependentServiceImpl>();

            var filterProvider = new UnityFilterAttributeFilterProvider( container );

            var controller = container.Resolve<ControllerStub>();
            controller.SetMockControllerContext();

            IActionInvoker a = new ActionInvokerExpecter<ActionFilteredResult>();

            RegisterFilterAttributeProvider( filterProvider );
            a.InvokeAction( controller.ControllerContext, "SimpleActionUnityDependent" );

            Assert.Throws<AssertionException>( () => a.InvokeAction( controller.ControllerContext, "SimpleAction" ), "Unity cannot injects dependencies without Dependency Attribute" );

            container.AddNewExtension<FilterAttributePropertyUnityContainerExtension>();
            a.InvokeAction( controller.ControllerContext, "SimpleAction" );
        }