private MvcEndpointDataSource CreateMvcEndpointDataSource( IActionDescriptorCollectionProvider actionDescriptorCollectionProvider = null, MvcEndpointInvokerFactory mvcEndpointInvokerFactory = null, IEnumerable <IActionDescriptorChangeProvider> actionDescriptorChangeProviders = null) { if (actionDescriptorCollectionProvider == null) { var mockDescriptorProvider = new Mock <IActionDescriptorCollectionProvider>(); mockDescriptorProvider.Setup(m => m.ActionDescriptors).Returns(new ActionDescriptorCollection(new List <ActionDescriptor>(), 0)); actionDescriptorCollectionProvider = mockDescriptorProvider.Object; } var serviceProviderMock = new Mock <IServiceProvider>(); serviceProviderMock.Setup(m => m.GetService(typeof(IActionDescriptorCollectionProvider))).Returns(actionDescriptorCollectionProvider); var dataSource = new MvcEndpointDataSource( actionDescriptorCollectionProvider, mvcEndpointInvokerFactory ?? new MvcEndpointInvokerFactory(new ActionInvokerFactory(Array.Empty <IActionInvokerProvider>())), actionDescriptorChangeProviders ?? Array.Empty <IActionDescriptorChangeProvider>(), serviceProviderMock.Object); return(dataSource); }
private MvcEndpointDataSource CreateMvcEndpointDataSource( IActionDescriptorCollectionProvider actionDescriptorCollectionProvider = null, MvcEndpointInvokerFactory mvcEndpointInvokerFactory = null) { if (actionDescriptorCollectionProvider == null) { actionDescriptorCollectionProvider = new DefaultActionDescriptorCollectionProvider( Array.Empty <IActionDescriptorProvider>(), Array.Empty <IActionDescriptorChangeProvider>()); } var services = new ServiceCollection(); services.AddSingleton(actionDescriptorCollectionProvider); var dataSource = new MvcEndpointDataSource( actionDescriptorCollectionProvider, mvcEndpointInvokerFactory ?? new MvcEndpointInvokerFactory(new ActionInvokerFactory(Array.Empty <IActionInvokerProvider>()))); return(dataSource); }
private MvcEndpointDataSource CreateMvcEndpointDataSource( IActionDescriptorCollectionProvider actionDescriptorCollectionProvider = null, MvcEndpointInvokerFactory mvcEndpointInvokerFactory = null) { if (actionDescriptorCollectionProvider == null) { actionDescriptorCollectionProvider = new DefaultActionDescriptorCollectionProvider( Array.Empty <IActionDescriptorProvider>(), Array.Empty <IActionDescriptorChangeProvider>()); } var serviceProviderMock = new Mock <IServiceProvider>(); serviceProviderMock.Setup(m => m.GetService(typeof(IActionDescriptorCollectionProvider))).Returns(actionDescriptorCollectionProvider); var dataSource = new MvcEndpointDataSource( actionDescriptorCollectionProvider, mvcEndpointInvokerFactory ?? new MvcEndpointInvokerFactory(new ActionInvokerFactory(Array.Empty <IActionInvokerProvider>())), serviceProviderMock.Object); return(dataSource); }