示例#1
0
        public HtmlTag VisualizePartial(ModelBindingLog log)
        {
            var title = "Model Binding for " + log.Report.ModelType.FullName;



            var collapsible = new CollapsibleTag(log.Id.ToString(), title);

            var description = Description.For(log.Report.Binder);

            collapsible.AppendContent(new HtmlTag("div").AddClass("model-binder-title").Text("Used " + description.Title));


            if (log.Report.OrderedProperties().Any())
            {
                var report = new ModelBindingHtmlReport();
                log.Report.AcceptVisitor(report);
                collapsible.AppendContent(report.Table);
            }
            else
            {
                var tag = new DescriptionBodyTag(description);
                collapsible.AppendContent(tag);
            }


            return(collapsible);
        }
        private HtmlTag buildCollapsedDescriptionTag(Description description, DescriptionBodyTag bodyTag)
        {
            var collapsible = new CollapsibleTag(Guid.NewGuid().ToString(), description.Title);

            collapsible.AppendContent(bodyTag);

            return(collapsible);
        }
示例#3
0
        private static HtmlTag toTag(ValueSourceReport report)
        {
            var table = new DetailsTableTag();

            foreach (var key in report.Values.GetAllKeys().OrderBy(x => x))
            {
                table.AddDetail(key, string.Join("; ", report.Values[key]));
            }

            var tag = new CollapsibleTag(report.ElementId(), report.Header());

            tag.AppendContent(table);

            return(tag.PrependAnchor());
        }
示例#4
0
 public void IsEmpty()
 {
     var tag = new CollapsibleTag("foo");
     Assert.AreEqual("<foo />", tag.ToString());
 }