예제 #1
0
        protected override void WriteHtmlTo(HtmlTextWriter writer)
        {
            var ul = new HtmlElement("ul");

            ul.MergeAttributes(HtmlAttributes);

            foreach (var current in Items)
            {
                CreateMenuNode(current).AppendTo(ul);
            }

            ul.WriteTo(writer);
        }
예제 #2
0
        protected override void WriteHtmlTo(HtmlTextWriter writer)
        {
            var ul = new HtmlElement("ul");

            ul.MergeAttributes(HtmlAttributes);

            for (var current = System.Web.SiteMap.CurrentNode; current != null; current = current.ParentNode)
            {
                CreateBreadcrumpNode(current, element => false).PrependTo(ul);
            }

            CreateBreadcrumpNode(LastNode(), element => true).AppendTo(ul);

            ul.WriteTo(writer);
        }
예제 #3
0
        public void Should_output_template()
        {
            Mock<TextWriter> output = new Mock<TextWriter>();
            output.Setup(w => w.Write("Template")).Verifiable();

            IHtmlNode tag = new HtmlElement("div");
            tag.Template((writer) => output.Object.Write("Template"));

            tag.WriteTo(output.Object);

            output.VerifyAll();
        }
예제 #4
0
        public void Should_write_to_text_writer()
        {
            Mock<TextWriter> output = new Mock<TextWriter>();
            output.Setup(w => w.Write("<div>")).Verifiable();
            output.Setup(w => w.Write("</div>")).Verifiable();

            IHtmlNode tag = new HtmlElement("div");
            tag.WriteTo(output.Object);

            output.VerifyAll();
        }
예제 #5
0
        public void Should_write_self_closing_tags_to_text_writer()
        {
            Mock<TextWriter> output = new Mock<TextWriter>();
            output.Setup(w => w.Write("<input />")).Verifiable();

            IHtmlNode tag = new HtmlElement("input", TagRenderMode.SelfClosing);

            tag.WriteTo(output.Object);

            output.VerifyAll();
        }