本文整理汇总了C#中Nancy.Testing.BrowserResponse.ShouldHaveRedirectedTo方法的典型用法代码示例。如果您正苦于以下问题:C# BrowserResponse.ShouldHaveRedirectedTo方法的具体用法?C# BrowserResponse.ShouldHaveRedirectedTo怎么用?C# BrowserResponse.ShouldHaveRedirectedTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nancy.Testing.BrowserResponse
的用法示例。
在下文中一共展示了BrowserResponse.ShouldHaveRedirectedTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterFairyTaleFigure
public void RegisterFairyTaleFigure(string name, string evilstring, int numberOfHangarounds = 0)
{
// Post a form via the browser
// save the response
_latestResponse = _browser.Post("/figure", with =>
{
with.FormValue("Name", name);
AddEvilFormValue(with, evilstring);
AddHangaroundsFormValues(with, numberOfHangarounds);
});
// We now expect a redirect according to the
// Post Redirect Get (PRG) pattern
// But we're really interested in the resulting 'page'
// so we follow that link and get the result
// view after the post back and save it in _latestResponse
var expectedPath = "/figure/" + name + "/View";
_latestResponse.ShouldHaveRedirectedTo(expectedPath);
_latestResponse = _browser.Get(expectedPath);
}