Example #1
0
        public void Should_be_able_to_post_form_with_anti_forgery_request_token_using_render()
        {
            Application.Execute(browser =>
            {
                const string username = "******";

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

                var response = browser.Render(context, payload).Submit(ctx => ctx.FormsAuth(username));

                Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
            });
        }
Example #2
0
 public ActionResult SubmitTextBox_Post(TextBoxPayload payload)
 {
     return Assert(() => payload.Text == "text");
 }
Example #3
0
 public ActionResult SubmitTextBox_Get(TextBoxPayload payload)
 {
     return PartialView("_FormTextBox");
 }
Example #4
0
 public ActionResult SubmitAntiForgeryRequestToken_Post(TextBoxPayload payload)
 {
     return Assert(() => payload.Text == "text");
 }
Example #5
0
        public void Should_be_able_to_post_form_with_textbox_using_render()
        {
            Application.Execute(browser =>
            {
                var payload = new TextBoxPayload { Text = "text" };
                var response = browser.Render("~/Views/_FormTextBox.cshtml", payload).Submit();

                Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
            });
        }
Example #6
0
        public void Should_be_able_to_post_form_with_textbox_using_load()
        {
            Application.Execute(browser =>
            {
                var payload = new TextBoxPayload { Text = "text" };
                var response = browser.Load(CrowbarRoute.SubmitTextBox.AsOutbound()).Submit(payload, overrides: (form, model) =>
                {
                    form.Find("input[type=\"text\"]").Val(model.Text);
                });

                Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
            });
        }