예제 #1
0
        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);
        }
예제 #2
0
        public MainPage()
        {
            InitializeComponent();

            EmptyProvider provider = new EmptyProvider();
            this.radMap.Provider = provider;
        }
예제 #3
0
        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>();
        }
예제 #4
0
        public MainWindow()
        {
            InitializeComponent();

            EmptyProvider provider = new EmptyProvider();

            this.radMap.Provider = provider;
        }
예제 #5
0
        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>();
        }
예제 #6
0
        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;
        }