public void DropDownListFor_creates_required_and_date_data_attributes_for_nullable_DateTime_with_Required_attribute() { // Arrange var htmlHelper = HtmlHelperFactory.Create(new RequiredNullableDateTimeModel()); // Act var result = DropDownListExtensions.DropDownListFor(htmlHelper, exampleModel => exampleModel.Date, true, new List <SelectListItem>()); // Assert Assert.AreEqual(HTMLRequiredDate, result.ToHtmlString()); }
public void DropDownListFor_creates_required_data_attributes_for_string_with_Required_attribute() { // Arrange var htmlHelper = HtmlHelperFactory.Create(new RequiredStringModel()); // Act var result = DropDownListExtensions.DropDownListFor(htmlHelper, exampleModel => exampleModel.String, true, new List <SelectListItem>()); // Assert Assert.AreEqual("<select " + "data-msg-required=\"The String field is required.\" " + "data-rule-required=\"true\" " + "id=\"String\" name=\"String\"></select>", result.ToHtmlString()); }