private ControllerActionDescriptorProvider GetProvider(
            TypeInfo controllerTypeInfo,
            IApplicationModelConvention convention)
        {
            var options = new TestOptionsManager<MvcOptions>();
            options.Value.Conventions.Add(convention);

            var controllerTypeProvider = new StaticControllerTypeProvider(new[] { controllerTypeInfo });
            var modelProvider = new DefaultApplicationModelProvider(options);

            var provider = new ControllerActionDescriptorProvider(
                controllerTypeProvider,
                new[] { modelProvider },
                options);

            return provider;
        }
        private ControllerActionDescriptorProvider GetProvider(
            params TypeInfo[] controllerTypeInfos)
        {
            var options = new TestOptionsManager<MvcOptions>();

            var controllerTypeProvider = new StaticControllerTypeProvider(controllerTypeInfos);
            var modelProvider = new DefaultApplicationModelProvider(options);

            var provider = new ControllerActionDescriptorProvider(
                controllerTypeProvider,
                new[] { modelProvider },
                options);

            return provider;
        }
        private ControllerActionDescriptorProvider GetProvider(
            TypeInfo controllerTypeInfo,
            IEnumerable<IFilterMetadata> filters = null)
        {
            var options = new TestOptionsManager<MvcOptions>();
            if (filters != null)
            {
                foreach (var filter in filters)
                {
                    options.Value.Filters.Add(filter);
                }
            }

            var controllerTypeProvider = new StaticControllerTypeProvider(new[] { controllerTypeInfo });
            var modelProvider = new DefaultApplicationModelProvider(options);

            var provider = new ControllerActionDescriptorProvider(
                controllerTypeProvider,
                new[] { modelProvider },
                options);

            return provider;
        }
        private ControllerActionDescriptorProvider GetActionDescriptorProvider()
        {
            var controllerTypes = typeof(DefaultActionSelectorTests)
                .GetNestedTypes(BindingFlags.NonPublic)
                .Select(t => t.GetTypeInfo())
                .ToList();

            var options = new TestOptionsManager<MvcOptions>();

            var controllerTypeProvider = new StaticControllerTypeProvider(controllerTypes);
            var modelProvider = new DefaultApplicationModelProvider(options);

            var provider = new ControllerActionDescriptorProvider(
                controllerTypeProvider,
                new[] { modelProvider },
                options);

            return provider;
        }
 private void Invoke(ControllerActionDescriptorProvider provider, ActionDescriptorProviderContext context)
 {
     provider.OnProvidersExecuting(context);
     provider.OnProvidersExecuted(context);
 }
        private ControllerActionDescriptorProvider CreateProvider()
        {
            var assemblyProvider = new StaticAssemblyProvider();
            assemblyProvider.CandidateAssemblies.Add(GetType().GetTypeInfo().Assembly);
            var controllerTypeProvider = new NamespaceFilteredControllerTypeProvider(assemblyProvider);

            var options = new MvcOptions();

            var setup = new WebApiCompatShimOptionsSetup();
            setup.Configure(options);

            var optionsAccessor = new Mock<IOptions<MvcOptions>>();
            optionsAccessor
                .SetupGet(o => o.Value)
                .Returns(options);

            var authorizationOptionsAccessor = new Mock<IOptions<AuthorizationOptions>>();
            authorizationOptionsAccessor
                .SetupGet(o => o.Value)
                .Returns(new AuthorizationOptions());

            var modelProvider = new DefaultApplicationModelProvider(optionsAccessor.Object);

            var provider = new ControllerActionDescriptorProvider(
                controllerTypeProvider,
                new[] { modelProvider },
                optionsAccessor.Object);

            return provider;
        }