private ControllerActionDescriptorProvider CreateProvider() { var assemblyProvider = new FixedSetAssemblyProvider(); assemblyProvider.CandidateAssemblies.Add(GetType().GetTypeInfo().Assembly); var controllerTypeProvider = new NamespaceFilteredControllerTypeProvider(assemblyProvider); var modelBuilder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), null); var filterProvider = new Mock <IGlobalFilterProvider>(); filterProvider .SetupGet(fp => fp.Filters) .Returns(new List <IFilter>()); var options = new MvcOptions(); var setup = new WebApiCompatShimOptionsSetup(); setup.Configure(options); var optionsAccessor = new Mock <IOptions <MvcOptions> >(); optionsAccessor .SetupGet(o => o.Options) .Returns(options); var provider = new ControllerActionDescriptorProvider( controllerTypeProvider, modelBuilder, filterProvider.Object, optionsAccessor.Object); return(provider); }
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); }
private ControllerActionDescriptorProvider CreateProvider() { var manager = GetApplicationManager(GetType().GetTypeInfo().Assembly.DefinedTypes.ToArray()); 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( manager, new[] { modelProvider }, optionsAccessor.Object); return(provider); }
private INestedProviderManager <ActionDescriptorProviderContext> CreateProvider() { var assemblyProvider = new Mock <IAssemblyProvider>(); assemblyProvider .SetupGet(ap => ap.CandidateAssemblies) .Returns(new Assembly[] { typeof(ApiControllerActionDiscoveryTest).Assembly }); var filterProvider = new Mock <IGlobalFilterProvider>(); filterProvider .SetupGet(fp => fp.Filters) .Returns(new List <IFilter>()); var conventions = new NamespaceLimitedActionDiscoveryConventions(); var options = new MvcOptions(); var setup = new WebApiCompatShimOptionsSetup(); setup.Configure(options); var optionsAccessor = new Mock <IOptions <MvcOptions> >(); optionsAccessor .SetupGet(o => o.Options) .Returns(options); var provider = new ControllerActionDescriptorProvider( assemblyProvider.Object, conventions, filterProvider.Object, optionsAccessor.Object); return(new NestedProviderManager <ActionDescriptorProviderContext>( new INestedProvider <ActionDescriptorProviderContext>[] { provider })); }
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; }
private ControllerActionDescriptorProvider CreateProvider() { var assemblyProvider = new FixedSetAssemblyProvider(); assemblyProvider.CandidateAssemblies.Add(GetType().GetTypeInfo().Assembly); var controllerTypeProvider = new NamespaceFilteredControllerTypeProvider(assemblyProvider); var modelBuilder = new DefaultControllerModelBuilder(new DefaultActionModelBuilder(null), null); var filterProvider = new Mock<IGlobalFilterProvider>(); filterProvider .SetupGet(fp => fp.Filters) .Returns(new List<IFilter>()); var options = new MvcOptions(); var setup = new WebApiCompatShimOptionsSetup(); setup.Configure(options); var optionsAccessor = new Mock<IOptions<MvcOptions>>(); optionsAccessor .SetupGet(o => o.Options) .Returns(options); var provider = new ControllerActionDescriptorProvider( controllerTypeProvider, modelBuilder, filterProvider.Object, optionsAccessor.Object); return provider; }