本文整理汇总了C#中INancyEngine类的典型用法代码示例。如果您正苦于以下问题:C# INancyEngine类的具体用法?C# INancyEngine怎么用?C# INancyEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
INancyEngine类属于命名空间,在下文中一共展示了INancyEngine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NancyOwinHostFixture
public NancyOwinHostFixture()
{
this.fakeEngine = A.Fake<INancyEngine>();
this.fakeBootstrapper = A.Fake<INancyBootstrapper>();
A.CallTo(() => this.fakeBootstrapper.GetEngine()).Returns(this.fakeEngine);
this.host = new NancyOwinHost(fakeBootstrapper);
this.fakeResponseCallback = (status, headers, bodyDelegate) => { };
this.fakeErrorCallback = (ex) => { };
this.environment = new Dictionary<string, object>()
{
{ "owin.RequestMethod", "GET" },
{ "owin.RequestPath", "/test" },
{ "owin.RequestPathBase", "/root" },
{ "owin.RequestQueryString", "var=value" },
{ "owin.RequestHeaders", new Dictionary<string, string> { { "Host", "testserver" } } },
{ "owin.RequestBody", null },
{ "owin.RequestScheme", "http" },
{ "owin.Version", "1.0" }
};
}
示例2: HttpHost
public HttpHost(IPEndPoint endpoint)
{
var bootStrapper = NancyBootstrapperLocator.Bootstrapper;
bootStrapper.Initialise();
m_Engine = bootStrapper.GetEngine();
m_EndPoint = endpoint;
}
示例3: NancyEngineFixture
public NancyEngineFixture()
{
this.resolver = A.Fake<IRouteResolver>();
this.response = new Response();
this.route = new FakeRoute(response);
this.context = new NancyContext();
this.errorHandler = A.Fake<IErrorHandler>();
this.requestDispatcher = A.Fake<IRequestDispatcher>();
A.CallTo(() => this.requestDispatcher.Dispatch(A<NancyContext>._)).Invokes(x => this.context.Response = new Response());
A.CallTo(() => errorHandler.HandlesStatusCode(A<HttpStatusCode>.Ignored, A<NancyContext>.Ignored)).Returns(false);
contextFactory = A.Fake<INancyContextFactory>();
A.CallTo(() => contextFactory.Create()).Returns(context);
A.CallTo(() => resolver.Resolve(A<NancyContext>.Ignored)).Returns(new ResolveResult(route, DynamicDictionary.Empty, null, null, null));
var applicationPipelines = new Pipelines();
this.routeInvoker = A.Fake<IRouteInvoker>();
A.CallTo(() => this.routeInvoker.Invoke(A<Route>._, A<DynamicDictionary>._, A<NancyContext>._)).ReturnsLazily(arg =>
{
return (Response)((Route)arg.Arguments[0]).Action.Invoke((DynamicDictionary)arg.Arguments[1]);
});
this.engine =
new NancyEngine(this.requestDispatcher, contextFactory, new[] { this.errorHandler }, A.Fake<IRequestTracing>())
{
RequestPipelinesFactory = ctx => applicationPipelines
};
}
示例4: NancyEngineFixture
public NancyEngineFixture()
{
this.modules = new[] { new FakeNancyModuleWithBasePath() };
this.locator = A.Fake<INancyModuleLocator>();
this.resolver = A.Fake<IRouteResolver>();
this.engine = new NancyEngine(this.locator, this.resolver);
}
示例5: Browser
/// <summary>
/// Initializes a new instance of the <see cref="Browser"/> class.
/// </summary>
/// <param name="bootstrapper">A <see cref="INancyBootstrapper"/> instance that determines the Nancy configuration that should be used by the browser.</param>
/// <param name="defaults">The default <see cref="BrowserContext"/> that should be used in a all requests through this browser object.</param>
public Browser(INancyBootstrapper bootstrapper, Action<BrowserContext> defaults = null, bool initialiseBootstrapper = true)
{
this.bootstrapper = bootstrapper;
if (initialiseBootstrapper) this.bootstrapper.Initialise();
this.engine = this.bootstrapper.GetEngine();
this.defaultBrowserContext = defaults ?? this.DefaultBrowserContext;
}
示例6: NancyEngineFixture
public NancyEngineFixture()
{
this.resolver = A.Fake<IRouteResolver>();
this.response = new Response();
this.route = new FakeRoute(response);
this.context = new NancyContext();
this.statusCodeHandler = A.Fake<IStatusCodeHandler>();
this.requestDispatcher = A.Fake<IRequestDispatcher>();
this.diagnosticsConfiguration = new DiagnosticsConfiguration();
A.CallTo(() => this.requestDispatcher.Dispatch(A<NancyContext>._, A<CancellationToken>._)).Invokes((x) => this.context.Response = new Response());
A.CallTo(() => this.statusCodeHandler.HandlesStatusCode(A<HttpStatusCode>.Ignored, A<NancyContext>.Ignored)).Returns(false);
contextFactory = A.Fake<INancyContextFactory>();
A.CallTo(() => contextFactory.Create(A<Request>._)).Returns(context);
var resolveResult = new ResolveResult { Route = route, Parameters = DynamicDictionary.Empty, Before = null, After = null, OnError = null };
A.CallTo(() => resolver.Resolve(A<NancyContext>.Ignored)).Returns(resolveResult);
var applicationPipelines = new Pipelines();
this.routeInvoker = A.Fake<IRouteInvoker>();
A.CallTo(() => this.routeInvoker.Invoke(A<Route>._, A<CancellationToken>._, A<DynamicDictionary>._, A<NancyContext>._)).ReturnsLazily(arg =>
{
return ((Route)arg.Arguments[0]).Action.Invoke((DynamicDictionary)arg.Arguments[1], A<CancellationToken>._).Result;
});
this.engine =
new NancyEngine(this.requestDispatcher, this.contextFactory, new[] { this.statusCodeHandler }, A.Fake<IRequestTracing>(), this.diagnosticsConfiguration, new DisabledStaticContentProvider())
{
RequestPipelinesFactory = ctx => applicationPipelines
};
}
示例7: RequestSpec
protected RequestSpec()
{
var locator =
new NancyModuleLocator(Assembly.GetExecutingAssembly());
engine = new NancyEngine(locator, new RouteResolver());
}
示例8: Browser
/// <summary>
/// Initializes a new instance of the <see cref="Browser"/> class.
/// </summary>
/// <param name="bootstrapper">A <see cref="INancyBootstrapper"/> instance that determines the Nancy configuration that should be used by the browser.</param>
/// <param name="defaults">The default <see cref="BrowserContext"/> that should be used in a all requests through this browser object.</param>
public Browser(INancyBootstrapper bootstrapper, Action<BrowserContext> defaults = null)
{
this.bootstrapper = bootstrapper;
this.bootstrapper.Initialise();
this.engine = this.bootstrapper.GetEngine();
this.defaultBrowserContext = defaults ?? DefaultBrowserContext;
}
示例9: Initialize
public static void Initialize()
{
var bootstrapper = new WebBootstrapper();
bootstrapper.Initialise();
_engine = bootstrapper.GetEngine();
//_host = new NancyOwinHost(null, NancyBootstrapperLocator.Bootstrapper);
}
示例10: NancyEngineFixture
public NancyEngineFixture()
{
this.application = A.Fake<INancyApplication>();
this.modules = NancyBootstrapper.BootstrapApplication().ModuleMetas;
this.resolver = A.Fake<IRouteResolver>();
this.engine = new NancyEngine(this.resolver, this.application);
}
示例11: NancyEngineFixture
public NancyEngineFixture()
{
this.modules = new NancyApplication(new DefaultModuleActivator()).GetModules();
this.locator = A.Fake<INancyModuleLocator>();
this.resolver = A.Fake<IRouteResolver>();
this.application = A.Fake<INancyApplication>();
this.engine = new NancyEngine(this.locator, this.resolver, this.application);
}
示例12: NancyHttpRequestHandler
public NancyHttpRequestHandler()
{
var bootstrapper =
GetBootstrapper();
this.engine =
bootstrapper.GetEngine();
}
示例13: InitNerdBeers
protected static void InitNerdBeers()
{
var bs = new Org.NerdBeers.Specs.Modules.SpecBootStrapper();
bs.Initialise();
Engine = bs.GetEngine();
DB = bs.DB;
Req = null;
}
示例14: NancyHost
public NancyHost(Uri baseUri, INancyBootstrapper bootStrapper)
{
this.baseUri = baseUri;
listener = new HttpListener();
listener.Prefixes.Add(baseUri.ToString());
engine = bootStrapper.GetEngine();
}
示例15: RequestSpec
protected RequestSpec()
{
var defaultNancyBootstrapper = new DefaultNancyBootstrapper();
defaultNancyBootstrapper.Initialise();
engine = defaultNancyBootstrapper.GetEngine();
}