public void CheckBoxNoHidden() { var htmlHelper = MvcHelper.GetHtmlHelper(); var component = new CheckBox(htmlHelper); var builder = new CheckBoxBuilder(component); builder .Name("IsActive") .IncludeHidden(false); var html = builder.ToHtmlString(); html.Should().Be(@"<input id=""IsActive"" name=""IsActive"" type=""checkbox"" value=""true"" />"); }
public void CheckBoxStrongName() { var htmlHelper = MvcHelper.GetHtmlHelper(); var component = new CheckBox(htmlHelper); var builder = new CheckBoxBuilder(component); builder .Name<Contact, bool>(c => c.IsActive) .Checked(); var sb = new System.Text.StringBuilder(); sb.AppendLine(@"<input checked=""checked"" id=""IsActive"" name=""IsActive"" type=""checkbox"" value=""true"" />"); sb.Append(@"<input name=""IsActive"" type=""hidden"" value=""false"" />"); var html = builder.ToHtmlString(); html.Should().Be(sb.ToString()); }