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


C# Browser.Get方法代码示例

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


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

示例1: Cookie_should_decode_value_correctly

        public async Task Cookie_should_decode_value_correctly()
        {
            // Given
            var browser = new Browser(with => with.Module<CookieModule>());

            // When
            await browser.Get("/setcookie");
                
            var result = await browser.Get("/getcookie");

            // Then
            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
        }
开发者ID:RadifMasud,项目名称:Nancy,代码行数:13,代码来源:CookieFixture.cs

示例2: TestMethod1

 public void TestMethod1()
 {
     var browser = new Browser();
       var result = browser.Get("/?test=success");
       Assert.AreEqual(200, result.StatusCode);
       Assert.AreEqual(true, result.ResponseText.Contains("success"));
 }
开发者ID:andyedinborough,项目名称:FakeHost,代码行数:7,代码来源:UnitTest1.cs

示例3: Should_fail_to_resolve_route_because_it_does_have_an_invalid_condition

        public void Should_fail_to_resolve_route_because_it_does_have_an_invalid_condition()
        {
            // Given
            var cache = new FakeRouteCache(with => {
                with.AddGetRoute("/invalidcondition", "modulekey", ctx => false);
            });

            var bootstrapper = new ConfigurableBootstrapper(with =>{
                with.RouteCache(cache);
            });

            var browser = new Browser(bootstrapper);

            // When
            var timer = new Stopwatch();
            timer.Start();

            for (var i = 0; i < numberOfTimesToResolveRoute; i++)
            {
                var result = browser.Get("/invalidcondition");
                result.StatusCode.ShouldEqual(HttpStatusCode.NotFound);
            }

            timer.Stop();

            // Then
            Debug.WriteLine(" took {0} to execute {1} times", timer.Elapsed, numberOfTimesToResolveRoute);
        }
开发者ID:felbus,项目名称:Nancy,代码行数:28,代码来源:DefaultRouteResolverPerformanceFixture.cs

示例4: WhenResumePageIsRequested_ShouldReturnProperTitle

 public void WhenResumePageIsRequested_ShouldReturnProperTitle()
 {
     using (var browser = new Browser())
     {
         var result = browser.Get("/Resume.aspx");
         Assert.IsTrue(result.ResponseText.Contains("Joymon Online | Resume"), "Resumes page title is wrong");
     }
 }
开发者ID:joymon,项目名称:JoymonOnline.In,代码行数:8,代码来源:Joymononline_Resume.cs

示例5: UrlIsValid

 public void UrlIsValid()
 {
     using (var browser = new Browser())
     {
         var result = browser.Get("/links.aspx");
         Assert.IsTrue(result.ResponseText.Contains("Joymon Online | Links"), "Links page title is wrong");
     }
 }
开发者ID:joymon,项目名称:JoymonOnline.In,代码行数:8,代码来源:Joymononline_Links.cs

示例6: TestDefaultCSS

 public void TestDefaultCSS()
 {
     using (var browser = new Browser())
     {
         var result = browser.Get("/App_Themes/Black/Default.css");
         Assert.IsTrue(result.StatusCode == 200, "Default.CSS failed");
     }
 }
开发者ID:joymon,项目名称:JoymonOnline.In,代码行数:8,代码来源:ResourceLoadTests.cs

示例7: TestBlogsPage

 public void TestBlogsPage()
 {
     using (var browser = new Browser())
     {
         var result = browser.Get("/Blogs.aspx");
         Assert.IsTrue(result.StatusCode == 200, "Main page failed");
     }
 }
开发者ID:joymon,项目名称:JoymonOnline.In,代码行数:8,代码来源:PageLoadTests.cs

示例8: WhenBlogsIsRequested_TitleShouldBeProper

 public void WhenBlogsIsRequested_TitleShouldBeProper()
 {
     using (var browser = new Browser())
     {
         var result = browser.Get("/Blogs.aspx");
         Assert.IsTrue(result.ResponseText.Contains("Joymon Online | Blogs"), "Default page is wrong");
     }
 }
开发者ID:joymon,项目名称:JoymonOnline.In,代码行数:8,代码来源:Joymononline_Blogs.cs

示例9: WhenViewResumeIsRequested_ShouldReturnIframeInContent

 public void WhenViewResumeIsRequested_ShouldReturnIframeInContent()
 {
     using (var browser = new Browser())
     {
         var result = browser.Get("/ViewResume.aspx");
         int actual = result.ResponseXml.Descendants("iframe").Count();
         Assert.AreEqual(1,actual,"iframe missing");
     }
 }
开发者ID:joymon,项目名称:JoymonOnline.In,代码行数:9,代码来源:JoymonOnline_ViewResume.cs

示例10: WhenDefaultCSSIsRequested_ShouldReturn200AndContent

 public void WhenDefaultCSSIsRequested_ShouldReturn200AndContent()
 {
     using (var browser = new Browser())
     {
         var result = browser.Get("/App_Themes/Black/Default.css");
         var actualSize = result.ResponseText.Length;
         Assert.IsTrue(actualSize > 1, "The expected size of {0} is > 1. But actual was {1}", "/App_Themes/Black/Default.css",actualSize);
     }
 }
开发者ID:joymon,项目名称:JoymonOnline.In,代码行数:9,代码来源:ResourceLoadTests.cs

示例11: WhenViewResumeIsRequested_ShouldReturnProperTtile

 public void WhenViewResumeIsRequested_ShouldReturnProperTtile()
 {
     using (var browser = new Browser())
     {
         var result = browser.Get("/ViewResume.aspx");
         string actual = result.ResponseXml.Descendants("title").First().Value.Trim();
         Assert.AreEqual("Joymon Online | View Resume", actual, "ViewResume page title is wrong");
     }
 }
开发者ID:joymon,项目名称:JoymonOnline.In,代码行数:9,代码来源:JoymonOnline_ViewResume.cs

示例12: WhenProjectsPageIsRequested_ShouldReturnWithProperTitle

        public void WhenProjectsPageIsRequested_ShouldReturnWithProperTitle()
        {
            using (var browser = new Browser())
            {
                var result = browser.Get("/Projects.aspx");
                string actual = result.ResponseXml.Descendants("title").First().Value.Trim();

                Assert.AreEqual("Joymon Online | Projects",actual, "Projects page title is wrong");
            }
        }
开发者ID:joymon,项目名称:JoymonOnline.In,代码行数:10,代码来源:JoymonOnline_Projects.cs

示例13: passes_multiple_queries_through_using_multiple_filters

    public void passes_multiple_queries_through_using_multiple_filters()
    {
      var filter = new PassthroughUriFilter(new string[] { "foo" }, new PassthroughUriFilter(new string[] { "blib" }));

      var appWithQueryString = new Browser(with => with.Module<TestModule>(), defaults: to => { to.Query("foo", "bar"); to.Query("blib", "blob"); });

      Uri result = filter.Apply(new Uri("http://www.nancyfx.org"), appWithQueryString.Get("").Context);

      Assert.Equal("?foo=bar&blib=blob", result.Query);
    }
开发者ID:IngvarKofoed,项目名称:Nancy.Linker,代码行数:10,代码来源:PassthroughUriFilterTests.cs

示例14: passes_the_query_through

    public void passes_the_query_through()
    {
      var filter = new PassthroughUriFilter(new string[] { "foo" });

      var appWithQueryString = new Browser(with => with.Module<TestModule>(), defaults: to => to.Query("foo", "bar"));

      Uri result = filter.Apply(new Uri("http://www.nancyfx.org"), appWithQueryString.Get("").Context);

      Assert.Equal("?foo=bar", result.Query);
    }
开发者ID:IngvarKofoed,项目名称:Nancy.Linker,代码行数:10,代码来源:PassthroughUriFilterTests.cs

示例15: WhenViewResumeIsRequested_ShouldReturnIframeAndItShouldPointToPDF

        public void WhenViewResumeIsRequested_ShouldReturnIframeAndItShouldPointToPDF()
        {
            using (var browser = new Browser())
            {
                var result = browser.Get("/ViewResume.aspx");
                string src = result.ResponseXml.Descendants("iframe").First().Attribute("src").Value;

                Assert.IsTrue(src.Contains("joy_resume.pdf"), "The iFrame.src is {0}. It doesn't have joy_resume.pdf",src);
            }
        }
开发者ID:joymon,项目名称:JoymonOnline.In,代码行数:10,代码来源:JoymonOnline_ViewResume.cs


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