public void CheckBoxList_Null() { var model = new Model1() { PropIntList = null }; var helper = new HtmlTagHelper(model); var name = "PropIntList"; var tag = helper.CheckBoxList( name, OptionsList.CreateForEnum <Enum1>()); Assert.Equal(3, tag.Children.Count()); CheckBoxListTagTest.AssertValidOption(tag.Options.Skip(0).First(), name: name, display: "Option1", value: 1, isChecked: false); CheckBoxListTagTest.AssertValidOption(tag.Options.Skip(1).First(), name: name, display: "Option2", value: 2, isChecked: false); CheckBoxListTagTest.AssertValidOption(tag.Options.Skip(2).First(), name: name, display: "Option3", value: 3, isChecked: false); }
public void CheckBoxList_NotNull_DefaultValue() { var model = new Model1() { PropIntList = Coll.Array(2, 3) }; var helper = new HtmlTagHelper(model); var name = "PropIntList"; var tag = helper.CheckBoxList( name, OptionsList.CreateForEnum<Enum1>(), defaultValues: Coll.Array(1, 2, 4)); Assert.Equal(3, tag.Children.Count()); CheckBoxListTagTest.AssertValidOption(tag.Options.Skip(0).First(), name: name, display: "Option1", value: 1, isChecked: false); CheckBoxListTagTest.AssertValidOption(tag.Options.Skip(1).First(), name: name, display: "Option2", value: 2, isChecked: true); CheckBoxListTagTest.AssertValidOption(tag.Options.Skip(2).First(), name: name, display: "Option3", value: 3, isChecked: true); }