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)); }); }
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); }
public ActionResult SubmitDropDown_Post(DropDownPayload payload) { return Assert(() => payload.Value == "2"); }
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)); }); }