Example #1
0
        public void Should_be_able_to_post_form_with_checkbox_using_render(bool condition)
        {
            Execute(client =>
            {
                var payload = new CheckBoxPayload { Condition = condition, SanityCheck = condition.ToString() };

                var response = client.Render("~/Views/Partials/_FormCheckBox.cshtml", payload).Submit();
                response.ShouldHaveStatusCode(HttpStatusCode.OK);
            });
        }
Example #2
0
        public void Should_be_able_to_post_form_with_checkbox_using_load(bool condition)
        {
            Execute(client =>
            {
                var payload = new CheckBoxPayload { Condition = condition, SanityCheck = condition.ToString() };
                var response = client.Load(CrowbarRoute.SubmitCheckBox.AsOutbound()).Submit(payload, overrides: (form, model) =>
                {
                    form.Find("input[type=\"text\"]").Val(model.SanityCheck);
                    form.Find("input[type=\"checkbox\"]").Get(0).Checked = model.Condition;
                });

                response.ShouldHaveStatusCode(HttpStatusCode.OK);
            });
        }
Example #3
0
 public ActionResult SubmitCheckBox_Post(CheckBoxPayload payload)
 {
     return Assert(() => payload.Condition.ToString() == payload.SanityCheck);
 }