public static IApplicationBuilder UseBuilder(this AddMiddleware app, IServiceProvider serviceProvider) { if (app == null) { throw new ArgumentNullException(nameof(app)); } // Do not set ApplicationBuilder.ApplicationServices to null. May fail later due to missing services but // at least that results in a more useful Exception than a NRE. if (serviceProvider == null) { serviceProvider = new EmptyProvider(); } // Adapt WebSockets by default. app(OwinWebSocketAcceptAdapter.AdaptWebSockets); var builder = new ApplicationBuilder(serviceProvider: serviceProvider); var middleware = CreateMiddlewareFactory(exit => { builder.Use(ignored => exit); return(builder.Build()); }, builder.ApplicationServices); app(middleware); return(builder); }
public MainPage() { InitializeComponent(); EmptyProvider provider = new EmptyProvider(); this.radMap.Provider = provider; }
public void TestInit() { _provider = new EmptyProvider(); MockContainer .GetMock <IActionContainerResolvingService>() .Setup(x => x.Resolve(typeof(IEnumerable <MethodDescriptor>), It.IsAny <string>())) .Returns(() => _methodDescriptors); MockContainer .GetMock <IActionContainerResolvingService>() .Setup(x => x.Resolve(typeof(IActionProvider), It.IsAny <string>())) .Returns(() => _provider); MockContainer .GetMock <IActionContainerResolvingService>() .Setup(x => x.ResolveAll(typeof(IActionListener))) .Returns(() => new[] { new DefaultActionListener(MockContainer.GetMock <IActionContainerResolvingService>().Object) }); _methodDescriptors = CreateMethodDescriptors(); _serviceAgent = MockContainer.Create <ServiceAgent>(); }
public MainWindow() { InitializeComponent(); EmptyProvider provider = new EmptyProvider(); this.radMap.Provider = provider; }
public void TestInit() { _provider = new EmptyProvider(); MockContainer .GetMock<IActionContainerResolvingService>() .Setup(x => x.Resolve(typeof(IEnumerable<MethodDescriptor>), It.IsAny<string>())) .Returns(() => _methodDescriptors); MockContainer .GetMock<IActionContainerResolvingService>() .Setup(x => x.Resolve(typeof(IActionProvider), It.IsAny<string>())) .Returns(() => _provider); MockContainer .GetMock<IActionContainerResolvingService>() .Setup(x => x.ResolveAll(typeof(IActionListener))) .Returns(() => new[] { new DefaultActionListener(MockContainer.GetMock<IActionContainerResolvingService>().Object) }); _methodDescriptors = CreateMethodDescriptors(); _serviceAgent = MockContainer.Create<ServiceAgent>(); }
public static IApplicationBuilder UseBuilder(this AddMiddleware app, IServiceProvider serviceProvider) { if (app == null) { throw new ArgumentNullException(nameof(app)); } // Do not set ApplicationBuilder.ApplicationServices to null. May fail later due to missing services but // at least that results in a more useful Exception than a NRE. if (serviceProvider == null) { serviceProvider = new EmptyProvider(); } // Adapt WebSockets by default. app(OwinWebSocketAcceptAdapter.AdaptWebSockets); var builder = new ApplicationBuilder(serviceProvider: serviceProvider); var middleware = CreateMiddlewareFactory(exit => { builder.Use(ignored => exit); return builder.Build(); }, builder.ApplicationServices); app(middleware); return builder; }