Пример #1
0
        public void Should_be_able_to_post_form_with_checkbox_using_render(bool condition)
        {
            Application.Execute(browser =>
            {
                var payload = new CheckBoxPayload { Condition = condition, SanityCheck = condition.ToString() };
                var response = browser.Render("~/Views/_FormCheckBox.cshtml", payload).Submit();

                Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
            });
        }
Пример #2
0
        public void Should_be_able_to_post_form_with_checkbox_using_load(bool condition)
        {
            Application.Execute(browser =>
            {
                var payload = new CheckBoxPayload { Condition = condition, SanityCheck = condition.ToString() };
                var response = browser.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;
                });

                Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
            });
        }
Пример #3
0
 public ActionResult SubmitCheckBox_Post(CheckBoxPayload payload)
 {
     return Assert(() => payload.Condition.ToString() == payload.SanityCheck);
 }