Esempio n. 1
0
        public void Should_be_able_to_post_form_with_anti_forgery_request_token_using_render()
        {
            Execute(client =>
            {
                const string username = "******";

                var context = new CrowbarViewContext("~/Views/Partials/_FormAntiForgeryRequestToken.cshtml").SetFormsAuthPrincipal(username);
                var payload = new TextBoxPayload { Text = "text" };

                var response = client.Render(context, payload).Submit(x => x.FormsAuth(username));
                response.ShouldHaveStatusCode(HttpStatusCode.OK);
            });
        }
Esempio n. 2
0
        public void Should_be_able_to_post_form_with_textbox_using_render()
        {
            Execute(client =>
            {
                var payload = new TextBoxPayload { Text = "text" };

                var response = client.Render("~/Views/Partials/_FormTextBox.cshtml", payload).Submit();
                response.ShouldHaveStatusCode(HttpStatusCode.OK);
            });
        }
Esempio n. 3
0
        public void Should_be_able_to_post_form_with_textbox_using_load()
        {
            Execute(client =>
            {
                var payload = new TextBoxPayload { Text = "text" };
                var response = client.Load(CrowbarRoute.SubmitTextBox.AsOutbound()).Submit(payload, overrides: (form, model) =>
                {
                    form.Find("input[type=\"text\"]").Val(model.Text);
                });

                response.ShouldHaveStatusCode(HttpStatusCode.OK);
            });
        }
Esempio n. 4
0
 public ActionResult SubmitTextBox_Post(TextBoxPayload payload)
 {
     return Assert(() => payload.Text == "text");
 }
Esempio n. 5
0
 public ActionResult SubmitTextBox_Get(TextBoxPayload payload)
 {
     return PartialView("_FormTextBox");
 }
Esempio n. 6
0
 public ActionResult SubmitAntiForgeryRequestToken_Post(TextBoxPayload payload)
 {
     return Assert(() => payload.Text == "text");
 }