public void ReadPostDataFromSelectFieldsWithOptionsWithValueAttribute() { var formHtml = new HtmlNodeBuilder("<form method=\"post\" action=\"result.aspx\">" + "<select id=\"salary\">" + "<option value=\"20000\">£20,000</option>" + "<option value=\"30000\">£30,000</option>" + "<option value=\"40000+\" selected>£40,000+</option>" + "</select>" + "</form>").Build(); var reader = new FormPostDataReader(formHtml); var postData = reader.PostData; Assert.That(postData["salary"], Is.EqualTo("40000+")); }
public void ReadMethodFromForm() { var formHtml = new HtmlNodeBuilder("<form method=\"post\" action=\"result.aspx\"></form>").Build(); var reader = new FormPostDataReader(formHtml); Assert.That(reader.Method, Is.EqualTo("post")); }
public void ReadPostDataFromInputFields() { var formHtml = new HtmlNodeBuilder("<form method=\"post\" action=\"result.aspx\">" + "<input id=\"login\" type=\"text\" value=\"helephant\" />" + "<input id=\"password\" type=\"password\" value=\"i love joe\" />" + "</form>").Build(); var reader = new FormPostDataReader(formHtml); var postData = reader.PostData; Assert.That(postData["login"], Is.EqualTo("helephant")); Assert.That(postData["password"], Is.EqualTo("i love joe")); }