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


C# Fakes.FakeRequest类代码示例

本文整理汇总了C#中Nancy.Tests.Fakes.FakeRequest的典型用法代码示例。如果您正苦于以下问题:C# FakeRequest类的具体用法?C# FakeRequest怎么用?C# FakeRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FakeRequest类属于Nancy.Tests.Fakes命名空间,在下文中一共展示了FakeRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsLocal_should_return_false_if_urlString_is_empty

        public void IsLocal_should_return_false_if_urlString_is_empty()
        {
            // Given when
            var request = new FakeRequest("GET", string.Empty, string.Empty, string.Empty);

            // Then
            Assert.False(request.IsLocal());
        }
开发者ID:sadiqhirani,项目名称:Nancy,代码行数:8,代码来源:RequestExtensionsFixture.cs

示例2: IsLocal_should_return_false_if_userHostAddr_is_not_localhost

        public void IsLocal_should_return_false_if_userHostAddr_is_not_localhost()
        {
            // Given when
            var request = new FakeRequest("GET", "/", string.Empty, "86.13.73.12");

            // Then
            Assert.False(request.IsLocal());
        }
开发者ID:sadiqhirani,项目名称:Nancy,代码行数:8,代码来源:RequestExtensionsFixture.cs

示例3: IsLocal_should_return_true_if_userHostAddr_is_localhost_IPV4

        public void IsLocal_should_return_true_if_userHostAddr_is_localhost_IPV4()
        {
            // Given when
            var request = new FakeRequest("POST", "/", string.Empty, "127.0.0.1");

            // Then
            Assert.True(request.IsLocal());
        }
开发者ID:sadiqhirani,项目名称:Nancy,代码行数:8,代码来源:RequestExtensionsFixture.cs

示例4: IsAjaxRequest_should_return_false_if_request_is_not_ajax

        public void IsAjaxRequest_should_return_false_if_request_is_not_ajax()
        {
            // Given when
            var request = new FakeRequest("POST", "/");

            // Then
            Assert.False(request.IsAjaxRequest());
        }
开发者ID:sadiqhirani,项目名称:Nancy,代码行数:8,代码来源:RequestExtensionsFixture.cs

示例5: IsLocal_should_return_true_if_userHostAddr_is_localhost_IPV6

        public void IsLocal_should_return_true_if_userHostAddr_is_localhost_IPV6()
        {
            // Given when
            var request = new FakeRequest("GET", "/", string.Empty, "::1");
            request.Url.HostName = "localhost";

            // Then
            Assert.True(request.IsLocal());
        }
开发者ID:RadifMasud,项目名称:Nancy,代码行数:9,代码来源:RequestExtensionsFixture.cs

示例6: TokenizerFixture

 public TokenizerFixture()
 {
     context = new NancyContext();
     request = new FakeRequest("GET", "/",
                               new Dictionary<string, IEnumerable<string>>
                               {
                                   {"User-Agent", new[] {"a fake user agent"}}
                               });
     context.Request = request;
 }
开发者ID:DarrellMozingo,项目名称:Nancy,代码行数:10,代码来源:TokenizerFixture.cs

示例7: Request_should_be_available_to_request_startup

        public void Request_should_be_available_to_request_startup()
        {
            this.bootstrapper.Initialise();
            var engine = this.bootstrapper.GetEngine();
            var request = new FakeRequest("GET", "/");

            engine.HandleRequest(request);

            this.bootstrapper.RequestStartupLastRequest.ShouldNotBeNull();
            this.bootstrapper.RequestStartupLastRequest.ShouldBeSameAs(request);
        }
开发者ID:nicolasgarfinkiel,项目名称:Nancy,代码行数:11,代码来源:DefaultNancyBootstrapperFixture.cs

示例8: Request_should_be_available_to_configure_request_container

        public void Request_should_be_available_to_configure_request_container()
        {
            this.bootstrapper.Initialise();
            var engine = this.bootstrapper.GetEngine();
            var request = new FakeRequest("GET", "/");

            engine.HandleRequest(request);

            this.bootstrapper.ConfigureRequestContainerLastRequest.ShouldNotBeNull();
            this.bootstrapper.ConfigureRequestContainerLastRequest.ShouldBeSameAs(request);
        }
开发者ID:nicolasgarfinkiel,项目名称:Nancy,代码行数:11,代码来源:DefaultNancyBootstrapperFixture.cs

示例9: Should_set_url_scheme_to_https_if_Forwarded_header_exists

        public void Should_set_url_scheme_to_https_if_Forwarded_header_exists()
        {
            var request = new FakeRequest("GET", "/",
               new Dictionary<string, IEnumerable<string>> { { "Forwarded", new[] { "for=192.0.2.60", "proto=https", "by=203.0.113.43" } } });

            var context = new NancyContext { Request = request };

            this.pipelines.BeforeRequest.Invoke(context, new CancellationToken());

            request.Url.Scheme.ShouldEqual("https");
        }
开发者ID:RadifMasud,项目名称:Nancy,代码行数:11,代码来源:SSLProxyFixture.cs

示例10: Should_only_initialise_request_container_once_per_request

        public void Should_only_initialise_request_container_once_per_request()
        {
            this.bootstrapper.Initialise();
            var engine = this.bootstrapper.GetEngine();
            var request = new FakeRequest("GET", "/");
            var request2 = new FakeRequest("GET", "/");

            engine.HandleRequest(request);
            engine.HandleRequest(request2);

            bootstrapper.RequestContainerInitialisations.Any(kvp => kvp.Value > 1).ShouldBeFalse();
        }
开发者ID:nicolasgarfinkiel,项目名称:Nancy,代码行数:12,代码来源:DefaultNancyBootstrapperFixture.cs

示例11: IsAjaxRequest_should_return_true_if_request_is_ajax

        public void IsAjaxRequest_should_return_true_if_request_is_ajax()
        {
            // Given
            var headers = new Dictionary<string, IEnumerable<string>>
            {
                { "X-Requested-With", new[] { "XMLHttpRequest" } }
            };

            // When
            var request = new FakeRequest("POST", "/", headers);

            // Then
            Assert.True(request.IsAjaxRequest());
        }
开发者ID:sadiqhirani,项目名称:Nancy,代码行数:14,代码来源:RequestExtensionsFixture.cs

示例12: Should_allow_head_request_when_route_is_defined_for_get

        public void Should_allow_head_request_when_route_is_defined_for_get()
        {
            var request = new FakeRequest("HEAD", "/foo/bar");
            var routeCache = new FakeRouteCache(x =>
            {
                x.AddGetRoute("/foo/bar");
            });

            var resolvedRoute = this.resolver.Resolve(request, routeCache);

            resolvedRoute.ShouldNotBeNull();
            resolvedRoute.ShouldNotBeOfType<NotFoundRoute>();
            resolvedRoute.ShouldNotBeOfType<MethodNotAllowedRoute>();
        }
开发者ID:avlasova,项目名称:Nancy,代码行数:14,代码来源:DefaultRouteResolverFixture.cs

示例13: Should_allow_options_request_when_route_is_defined

        public void Should_allow_options_request_when_route_is_defined()
        {
            // Given
            var request = new FakeRequest("OPTIONS", "/foo/bar");
            var context = new NancyContext { Request = request };
            var resolver = CreateResolver(x => x.AddGetRoute("/foo/bar"));

            // When
            var resolvedRoute = resolver.Resolve(context);

            // Then
            resolvedRoute.ShouldNotBeNull();
            resolvedRoute.Item1.ShouldBeOfType<OptionsRoute>();
        }
开发者ID:synhershko,项目名称:Nancy,代码行数:14,代码来源:DefaultRouteResolverFixture.cs

示例14: Should_only_initialise_request_container_once_per_request

        public async Task Should_only_initialise_request_container_once_per_request()
        {
            // Given
            this.bootstrapper.Initialise();
            var engine = this.bootstrapper.GetEngine();
            var request = new FakeRequest("GET", "/");
            var request2 = new FakeRequest("GET", "/");

            // When
            await engine.HandleRequest(request);
            await engine.HandleRequest(request2);

            // Then
            bootstrapper.RequestContainerInitialisations.Any(kvp => kvp.Value > 1).ShouldBeFalse();
        }
开发者ID:RadifMasud,项目名称:Nancy,代码行数:15,代码来源:DefaultNancyBootstrapperFixture.cs

示例15: Should_allow_head_request_when_route_is_defined_for_get

        public void Should_allow_head_request_when_route_is_defined_for_get()
        {
            // Given
            var request = new FakeRequest("HEAD", "/foo/bar");
            var context = new NancyContext { Request = request };
            var resolver = CreateResolver(x => x.AddGetRoute("/bar/foo"));

            // When
            var resolvedRoute = resolver.Resolve(context);

            // Then
            resolvedRoute.ShouldNotBeNull();
            resolvedRoute.ShouldNotBeOfType<NotFoundRoute>();
            resolvedRoute.ShouldNotBeOfType<MethodNotAllowedRoute>();
        }
开发者ID:synhershko,项目名称:Nancy,代码行数:15,代码来源:DefaultRouteResolverFixture.cs


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