コード例 #1
0
        public void CheckBoxListFor_Null()
        {
            var model = new Model1()
            {
                PropIntList = null
            };
            var helper = new HtmlTagHelper <Model1>(model);

            var propExpression = Expr((Model1 m) => m.PropIntList);
            var tag            = helper.CheckBoxListFor(
                propExpression,
                OptionsList.CreateForEnum <Enum1>());

            Assert.Equal(3, tag.Children.Count());
            CheckBoxListTagTest.AssertValidOption(tag.Options.Skip(0).First(), name: "PropIntList", display: "Option1", value: 1, isChecked: false);
            CheckBoxListTagTest.AssertValidOption(tag.Options.Skip(1).First(), name: "PropIntList", display: "Option2", value: 2, isChecked: false);
            CheckBoxListTagTest.AssertValidOption(tag.Options.Skip(2).First(), name: "PropIntList", display: "Option3", value: 3, isChecked: false);
        }
コード例 #2
0
        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);
        }