本文整理汇总了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;
}
示例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>();
}
示例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>();
}
示例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!");
}
示例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);
}
示例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);
}
示例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);
}