public void ForModel_GET_RendersForm() { Test(async http => { var response = await http.GetAsync(FormsActions.ForModel()); var form = response.Form <ForModelPost>(); form.GetText(m => m.BasicValue).Should().BeNullOrWhiteSpace(); }); }
public void ForModel_GET_RendersValues() { Test(async http => { var response = await http.GetAsync(FormsActions.ForModel("testValue")); var form = response.Form <ForModelPost>(); form.GetText(m => m.BasicValue).Should().Be("testValue"); response.Text.Should().Contain("BasicValue=testValue"); response.Text.Should().Contain("{validation=").And.Contain("></span>}"); }); }
public void ForModel_POST_RendersValidationErrors() { Test(async http => { var response = await http.GetAsync(FormsActions.ForModel("testValue")) .Form <ForModelPost>().Result .SetText(m => m.BasicValue, "tst") .Submit(r => r.SetExpectedResponse(HttpStatusCode.OK)); var form = response.Form <ForModelPost>(); form.GetText(m => m.BasicValue).Should().Be("tst"); response.Text.Should().Contain("validationErrorMessage"); }); }