Example #1
0
        public void BooleanTemplateTests()
        {
            // Boolean values

            Assert.AreEqual(
                @"<input checked=""checked"" class=""check-box"" id=""FieldPrefix"" name=""FieldPrefix"" type=""checkbox"" value=""true"" /><input name=""FieldPrefix"" type=""hidden"" value=""false"" />",
                DefaultEditorTemplates.BooleanTemplate(MakeHtmlHelper <bool>(true)));

            Assert.AreEqual(
                @"<input class=""check-box"" id=""FieldPrefix"" name=""FieldPrefix"" type=""checkbox"" value=""true"" /><input name=""FieldPrefix"" type=""hidden"" value=""false"" />",
                DefaultEditorTemplates.BooleanTemplate(MakeHtmlHelper <bool>(false)));

            Assert.AreEqual(
                @"<input class=""check-box"" id=""FieldPrefix"" name=""FieldPrefix"" type=""checkbox"" value=""true"" /><input name=""FieldPrefix"" type=""hidden"" value=""false"" />",
                DefaultEditorTemplates.BooleanTemplate(MakeHtmlHelper <bool>(null)));

            // Nullable<Boolean> values

            Assert.AreEqual(
                @"<select class=""list-box tri-state"" id=""FieldPrefix"" name=""FieldPrefix""><option value="""">Not Set</option>
<option selected=""selected"" value=""true"">True</option>
<option value=""false"">False</option>
</select>",
                DefaultEditorTemplates.BooleanTemplate(MakeHtmlHelper <Nullable <bool> >(true)));

            Assert.AreEqual(
                @"<select class=""list-box tri-state"" id=""FieldPrefix"" name=""FieldPrefix""><option value="""">Not Set</option>
<option value=""true"">True</option>
<option selected=""selected"" value=""false"">False</option>
</select>",
                DefaultEditorTemplates.BooleanTemplate(MakeHtmlHelper <Nullable <bool> >(false)));

            Assert.AreEqual(
                @"<select class=""list-box tri-state"" id=""FieldPrefix"" name=""FieldPrefix""><option selected=""selected"" value="""">Not Set</option>
<option value=""true"">True</option>
<option value=""false"">False</option>
</select>",
                DefaultEditorTemplates.BooleanTemplate(MakeHtmlHelper <Nullable <bool> >(null)));
        }
        public void BooleanTemplateTests()
        {
            // Boolean values

            Assert.Equal(
                "<input checked=\"checked\" class=\"check-box\" id=\"FieldPrefix\" name=\"FieldPrefix\" type=\"checkbox\" value=\"true\" /><input name=\"FieldPrefix\" type=\"hidden\" value=\"false\" />",
                DefaultEditorTemplates.BooleanTemplate(MakeHtmlHelper <bool>(true)));

            Assert.Equal(
                "<input class=\"check-box\" id=\"FieldPrefix\" name=\"FieldPrefix\" type=\"checkbox\" value=\"true\" /><input name=\"FieldPrefix\" type=\"hidden\" value=\"false\" />",
                DefaultEditorTemplates.BooleanTemplate(MakeHtmlHelper <bool>(false)));

            Assert.Equal(
                "<input class=\"check-box\" id=\"FieldPrefix\" name=\"FieldPrefix\" type=\"checkbox\" value=\"true\" /><input name=\"FieldPrefix\" type=\"hidden\" value=\"false\" />",
                DefaultEditorTemplates.BooleanTemplate(MakeHtmlHelper <bool>(null)));

            // Nullable<Boolean> values

            Assert.Equal(
                "<select class=\"list-box tri-state\" id=\"FieldPrefix\" name=\"FieldPrefix\"><option value=\"\">Not Set</option>" + Environment.NewLine
                + "<option selected=\"selected\" value=\"true\">True</option>" + Environment.NewLine
                + "<option value=\"false\">False</option>" + Environment.NewLine
                + "</select>",
                DefaultEditorTemplates.BooleanTemplate(MakeHtmlHelper <Nullable <bool> >(true)));

            Assert.Equal(
                "<select class=\"list-box tri-state\" id=\"FieldPrefix\" name=\"FieldPrefix\"><option value=\"\">Not Set</option>" + Environment.NewLine
                + "<option value=\"true\">True</option>" + Environment.NewLine
                + "<option selected=\"selected\" value=\"false\">False</option>" + Environment.NewLine
                + "</select>",
                DefaultEditorTemplates.BooleanTemplate(MakeHtmlHelper <Nullable <bool> >(false)));

            Assert.Equal(
                "<select class=\"list-box tri-state\" id=\"FieldPrefix\" name=\"FieldPrefix\"><option selected=\"selected\" value=\"\">Not Set</option>" + Environment.NewLine
                + "<option value=\"true\">True</option>" + Environment.NewLine
                + "<option value=\"false\">False</option>" + Environment.NewLine
                + "</select>",
                DefaultEditorTemplates.BooleanTemplate(MakeHtmlHelper <Nullable <bool> >(null)));
        }