public void should_serve_convert_md2html_api_correctly() { _app.Path("/api/common/md2html") .Post() .WithForm(new { markdown = "# 中文的 title" }) .ShouldSuccess(_app.MockUser()) .WithApiResult((api, result) => result["html"].ToString() .ShouldContain("<h2>中文的 title</h2>")) .And .ShouldFail(_app.NoUser()) .WithSigninRedirect(); }
void should_be_able_to_signin_new_user() { var username = StringUtility.Random(); var password = "******"; _app.CreateUser(username, password); _app.Path("/signin") .Post() .WithForm(new { UserName = username, Password = password }) .ShouldSuccessWithRedirect(_app.NoUser()) .WithResponse(response => { var cookieHeaders = response.Headers.GetValues("Set-Cookie").ToList(); cookieHeaders.ShouldContain(cookie => cookie.Contains(".AspNetCore.Identity.Application")); }); }