当前位置: 首页>>代码示例>>C#>>正文


C# ConfigurableBootstrapper.GetEngine方法代码示例

本文整理汇总了C#中ConfigurableBootstrapper.GetEngine方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigurableBootstrapper.GetEngine方法的具体用法?C# ConfigurableBootstrapper.GetEngine怎么用?C# ConfigurableBootstrapper.GetEngine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConfigurableBootstrapper的用法示例。


在下文中一共展示了ConfigurableBootstrapper.GetEngine方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateBrowserWithCancellationToken

		public static Browser CreateBrowserWithCancellationToken(RouteRegistrar registrar, CancellationToken cancel)
		{
			var bootstrapper = new ConfigurableBootstrapper(with => with
				.Module(new AsyncCancelModule(registrar))
				.NancyEngine<NancyEngineWithAsyncCancellation>());

			var browser = new Browser(bootstrapper);
			((NancyEngineWithAsyncCancellation) bootstrapper.GetEngine()).CancellationToken = cancel;
			return browser;
		}
开发者ID:serenata-evaldas,项目名称:Nancy.ServiceRouting,代码行数:10,代码来源:AsyncCancellationBrowserFactory.cs

示例2: Should_use_default_type_when_no_type_or_instance_overrides_have_been_configured

        public void Should_use_default_type_when_no_type_or_instance_overrides_have_been_configured()
        {
            // Given
            var bootstrapper = new ConfigurableBootstrapper();
            bootstrapper.Initialise();

            // When
            var engine = bootstrapper.GetEngine();

            // Then
            engine.ShouldBeOfType<NancyEngine>();
        }
开发者ID:nclarence,项目名称:WebAPI.Testing,代码行数:12,代码来源:ConfigurableBootstrapperFixture.cs

示例3: Should_use_type_override_when_it_has_been_configured

        public void Should_use_type_override_when_it_has_been_configured()
        {
            // Given
            var bootstrapper = new ConfigurableBootstrapper(with =>
            {
                with.NancyEngine<FakeNancyEngine>();
            });

            bootstrapper.Initialise();

            // When
            var engine = bootstrapper.GetEngine();

            // Then
            engine.ShouldBeOfType<FakeNancyEngine>();
        }
开发者ID:nclarence,项目名称:WebAPI.Testing,代码行数:16,代码来源:ConfigurableBootstrapperFixture.cs

示例4: Should_throw_exceptions_if_any_occur_in_route

        public void Should_throw_exceptions_if_any_occur_in_route()
        {
            var bootstrapper = new ConfigurableBootstrapper(with =>
                {
                    with.Module<BlowUpModule>();
                });
            bootstrapper.Initialise();
            var engine = bootstrapper.GetEngine();
            var request = new Request("GET", "/", "http");

            var result = Record.Exception(() => engine.HandleRequest(request));

            result.ShouldNotBeNull();
            result.ShouldBeOfType<Exception>();
            result.ToString().ShouldContain("Oh noes!");
        }
开发者ID:nicolasgarfinkiel,项目名称:Nancy,代码行数:16,代码来源:ConfigurableBootstrapperFixture.cs

示例5: Should_use_instance_override_when_it_has_been_configured

        public void Should_use_instance_override_when_it_has_been_configured()
        {
            // Given
            var fakeEngine = A.Fake<INancyEngine>();

            var bootstrapper = new ConfigurableBootstrapper(with =>
            {
                with.NancyEngine(fakeEngine);
            });

            bootstrapper.Initialise();

            // When
            var engine = bootstrapper.GetEngine();

            // Then
            engine.ShouldBeSameAs(fakeEngine);
        }
开发者ID:nclarence,项目名称:WebAPI.Testing,代码行数:18,代码来源:ConfigurableBootstrapperFixture.cs

示例6: Should_run_application_startup_closure

        public void Should_run_application_startup_closure()
        {
            var date = new DateTime(2112,10,31);
            var bootstrapper = new ConfigurableBootstrapper(with => with.ApplicationStartup((container, pipelines) =>
                {
                    pipelines.BeforeRequest += ctx =>
                        {
                            ctx.Items.Add("date", date);
                            return null;
                        };
                }));

            bootstrapper.Initialise();

            var engine = bootstrapper.GetEngine();
            var request = new Request("GET", "/", "http");
            var result = engine.HandleRequest(request);

            result.Items["date"].ShouldEqual(date);
        }
开发者ID:tischlda,项目名称:Nancy,代码行数:20,代码来源:ConfigurableBootstrapperFixture.cs

示例7: Should_run_request_startup_closure

        public void Should_run_request_startup_closure()
        {
            var date = new DateTime(2112, 10, 31);
            var bootstrapper =
                new ConfigurableBootstrapper(
                    with => with.RequestStartup((container, pipelines, context) => 
                        context.Items.Add("date", date)));

            bootstrapper.Initialise();

            var engine = bootstrapper.GetEngine();
            var request = new Request("GET", "/", "http");
            var result = engine.HandleRequest(request);

            result.Items["date"].ShouldEqual(date);
        }
开发者ID:nclarence,项目名称:WebAPI.Testing,代码行数:16,代码来源:ConfigurableBootstrapperFixture.cs


注:本文中的ConfigurableBootstrapper.GetEngine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。