예제 #1
0
        private ControllerActionDescriptorProvider GetActionDescriptorProvider()
        {
            var assemblyProvider = new StaticAssemblyProvider();

            var controllerTypes = typeof(DefaultActionSelectorTests)
                                  .GetNestedTypes(BindingFlags.NonPublic)
                                  .Select(t => t.GetTypeInfo());

            var modelBuilder = new StaticControllerModelBuilder(controllerTypes.ToArray());

            return(new ControllerActionDescriptorProvider(
                       assemblyProvider,
                       modelBuilder,
                       new TestGlobalFilterProvider(),
                       new MockMvcOptionsAccessor()));
        }
예제 #2
0
        private ControllerActionDescriptorProvider GetActionDescriptorProvider(
            IActionDiscoveryConventions actionDiscoveryConventions = null)
        {
            var assemblyProvider = new StaticAssemblyProvider();

            if (actionDiscoveryConventions == null)
            {
                var controllerTypes = typeof(ActionAttributeTests)
                                      .GetNestedTypes(BindingFlags.NonPublic)
                                      .Select(t => t.GetTypeInfo());

                actionDiscoveryConventions = new StaticActionDiscoveryConventions(controllerTypes.ToArray());
            }

            return(new ControllerActionDescriptorProvider(
                       assemblyProvider,
                       actionDiscoveryConventions,
                       new TestGlobalFilterProvider(),
                       new MockMvcOptionsAccessor()));
        }