Example #1
0
        public void Should_be_able_to_post_form_with_drop_down_using_load()
        {
            Application.Execute(browser =>
            {
                var payload = new DropDownPayload
                {
                    Value = "2"
                };

                var response = browser.Load(CrowbarRoute.SubmitDropDown.AsOutbound()).Submit(payload, overrides: (form, model) =>
                {
                    form.Find("select").Val(model.Value);
                });

                Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
            });
        }
Example #2
0
        public ActionResult SubmitDropDown_Get()
        {
            var model = new DropDownPayload
            {
                Values = new List<DropDownPayload.DropDownItem>
                {
                    new DropDownPayload.DropDownItem
                    {
                        Text = "black",
                        Value = "1"
                    },
                    new DropDownPayload.DropDownItem
                    {
                        Text = "white",
                        Value = "2"
                    },
                }
            };

            return PartialView("_FormDropDown", model);
        }
Example #3
0
 public ActionResult SubmitDropDown_Post(DropDownPayload payload)
 {
     return Assert(() => payload.Value == "2");
 }
Example #4
0
        public void Should_be_able_to_post_form_with_drop_down_using_render()
        {
            Application.Execute(browser =>
            {
                var payload = new DropDownPayload
                {
                    Values = new List<DropDownPayload.DropDownItem>
                    {
                        new DropDownPayload.DropDownItem
                        {
                            Text = "black",
                            Value = "1"
                        },
                        new DropDownPayload.DropDownItem
                        {
                            Text = "white",
                            Value = "2",
                            Selected = true
                        },
                    }
                };

                var response = browser.Render("~/Views/_FormDropDown.cshtml", payload).Submit();

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