本文整理汇总了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);
}
示例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"));
}
示例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);
}
示例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");
}
}
示例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");
}
}
示例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");
}
}
示例7: TestBlogsPage
public void TestBlogsPage()
{
using (var browser = new Browser())
{
var result = browser.Get("/Blogs.aspx");
Assert.IsTrue(result.StatusCode == 200, "Main page failed");
}
}
示例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");
}
}
示例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");
}
}
示例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);
}
}
示例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");
}
}
示例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");
}
}
示例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);
}
示例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);
}
示例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);
}
}