本文整理汇总了C#中INancyEngine类的典型用法代码示例。如果您正苦于以下问题:C# INancyEngine类的具体用法?C# INancyEngine怎么用?C# INancyEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
INancyEngine类属于命名空间,在下文中一共展示了INancyEngine类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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" }
};
}
开发者ID:ChrisMH,项目名称:Nancy,代码行数:26,代码来源:NancyOwinHostFixture.cs
示例2: HancyHandlerFixture
public HancyHandlerFixture()
{
this.context = A.Fake<HttpContextBase>();
this.request = A.Fake<HttpRequestBase>();
this.response = A.Fake<HttpResponseBase>();
this.engine = A.Fake<INancyEngine>();
handler = new NancyHandler(engine);
A.CallTo(() => this.context.Request).Returns(this.request);
A.CallTo(() => this.context.Response).Returns(this.response);
A.CallTo(() => this.response.OutputStream).Returns(new MemoryStream());
}
开发者ID:ryansroberts,项目名称:Nancy,代码行数:12,代码来源:HancyHandlerFixture.cs
示例3: NancyHandlerFixture
public NancyHandlerFixture()
{
this.context = A.Fake<HttpContextBase>();
this.request = A.Fake<HttpRequestBase>();
this.response = A.Fake<HttpResponseBase>();
this.engine = A.Fake<INancyEngine>();
this.handler = new NancyHandler(engine);
this.formData = new NameValueCollection();
A.CallTo(() => this.request.Form).ReturnsLazily(() => this.formData);
A.CallTo(() => this.request.Url).Returns(new Uri("http://www.foo.com"));
A.CallTo(() => this.request.InputStream).Returns(new MemoryStream());
A.CallTo(() => this.request.Headers).Returns(new NameValueCollection());
A.CallTo(() => this.request.AppRelativeCurrentExecutionFilePath).Returns("~/foo");
A.CallTo(() => this.context.Request).Returns(this.request);
A.CallTo(() => this.context.Response).Returns(this.response);
A.CallTo(() => this.response.OutputStream).Returns(new MemoryStream());
}
开发者ID:rahulchrty,项目名称:Nancy,代码行数:19,代码来源:NancyHandlerFixture.cs
示例4: HttpHost
public HttpHost(IPEndPoint endpoint)
{
var bootStrapper = NancyBootstrapperLocator.Bootstrapper;
bootStrapper.Initialise();
m_Engine = bootStrapper.GetEngine();
m_EndPoint = endpoint;
}
开发者ID:rmc47,项目名称:CloudlogCAT,代码行数:7,代码来源:HttpHost.cs
示例5: 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
};
}
开发者ID:rhwy,项目名称:Nancy,代码行数:33,代码来源:NancyEngineFixture.cs
示例6: 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);
}
开发者ID:dineshkummarc,项目名称:Nancy,代码行数:7,代码来源:NancyEngineFixture.cs
示例7: 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;
}
开发者ID:AIexandr,项目名称:Nancy,代码行数:12,代码来源:Browser.cs
示例8: 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
};
}
开发者ID:randacc,项目名称:Nancy,代码行数:35,代码来源:NancyEngineFixture.cs
示例9: RequestSpec
protected RequestSpec()
{
var locator =
new NancyModuleLocator(Assembly.GetExecutingAssembly());
engine = new NancyEngine(locator, new RouteResolver());
}
开发者ID:gregsochanik,项目名称:Nancy,代码行数:7,代码来源:RequestSpec.cs
示例10: 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;
}
开发者ID:rdterner,项目名称:Nancy,代码行数:12,代码来源:Browser.cs
示例11: Initialize
public static void Initialize()
{
var bootstrapper = new WebBootstrapper();
bootstrapper.Initialise();
_engine = bootstrapper.GetEngine();
//_host = new NancyOwinHost(null, NancyBootstrapperLocator.Bootstrapper);
}
开发者ID:cubedj,项目名称:fourdeltaone,代码行数:7,代码来源:WebManager.cs
示例12: 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);
}
开发者ID:meadiagenic,项目名称:Nancy,代码行数:7,代码来源:NancyEngineFixture.cs
示例13: 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);
}
开发者ID:ryansroberts,项目名称:Nancy,代码行数:8,代码来源:NancyEngineFixture.cs
示例14: NancyHttpRequestHandler
public NancyHttpRequestHandler()
{
var bootstrapper =
GetBootstrapper();
this.engine =
bootstrapper.GetEngine();
}
开发者ID:avlasova,项目名称:Nancy,代码行数:8,代码来源:NancyHttpRequestHandler.cs
示例15: InitNerdBeers
protected static void InitNerdBeers()
{
var bs = new Org.NerdBeers.Specs.Modules.SpecBootStrapper();
bs.Initialise();
Engine = bs.GetEngine();
DB = bs.DB;
Req = null;
}
开发者ID:GraemeF,项目名称:NerdBeers,代码行数:8,代码来源:_with_NerdBeersContext.cs
示例16: NancyHost
public NancyHost(Uri baseUri, INancyBootstrapper bootStrapper)
{
this.baseUri = baseUri;
listener = new HttpListener();
listener.Prefixes.Add(baseUri.ToString());
engine = bootStrapper.GetEngine();
}
开发者ID:avlasova,项目名称:Nancy,代码行数:8,代码来源:NancyHost.cs
示例17: RequestSpec
protected RequestSpec()
{
var defaultNancyBootstrapper = new DefaultNancyBootstrapper();
defaultNancyBootstrapper.Initialise();
engine = defaultNancyBootstrapper.GetEngine();
}
开发者ID:nathanpalmer,项目名称:Nancy,代码行数:8,代码来源:RequestSpec.cs
示例18: NancyEvent2Host
public NancyEvent2Host(string host, int port, INancyBootstrapper bootstrapper)
{
_host = host;
_port = port;
_bootstrapper = bootstrapper;
_bootstrapper.Initialise();
_engine = _bootstrapper.GetEngine();
}
开发者ID:kekekeks,项目名称:Nancy.Hosting.Event.2,代码行数:8,代码来源:NancyEvent2Host.cs
示例19: NancyHttpRequestHandler
static NancyHttpRequestHandler()
{
var bootstrapper = GetBootstrapper();
bootstrapper.Initialise();
engine = bootstrapper.GetEngine();
}
开发者ID:rahulchrty,项目名称:Nancy,代码行数:8,代码来源:NancyHttpRequestHandler.cs
示例20: NancyEngineFixture
public NancyEngineFixture()
{
this.resolver = A.Fake<IRouteResolver>();
this.route = new FakeRoute();
A.CallTo(() => resolver.Resolve(A<Request>.Ignored, A<IRouteCache>.Ignored.Argument)).Returns(route);
this.engine = new NancyEngine(resolver, A.Fake<IRouteCache>());
}
开发者ID:avlasova,项目名称:Nancy,代码行数:8,代码来源:NancyEngineFixture.cs
注:本文中的INancyEngine类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论