public TreeViewBuilderTests()
        {
            Mock <HtmlTextWriter> writer = new Mock <HtmlTextWriter>(TextWriter.Null);

            treeView = TreeViewTestHelper.CreateTreeView(writer.Object, null, new Mock <IClientSideObjectWriter>().Object);
            builder  = new TreeViewBuilder(treeView);
        }
        public TreeViewRenderingTests()
        {
            Mock <TextWriter>     textWriter = new Mock <TextWriter>();
            Mock <HtmlTextWriter> writer     = new Mock <HtmlTextWriter>(textWriter.Object);

            objectWriter = new Mock <IClientSideObjectWriter>();

            var list = new List <IHtmlNode>();

            list.Add(new HtmlElement("div"));

            var rootTag = new Mock <IHtmlNode>();

            rootTag.SetupGet(t => t.Children).Returns(() => list);

            var itemTag = new Mock <IHtmlNode>();

            itemTag.SetupGet(t => t.Children).Returns(() => list);
            itemTag.Setup(t => t.AppendTo(It.IsAny <IHtmlNode>())).Returns(() => itemTag.Object);

            builder = new Mock <ITreeViewHtmlBuilder>();
            builder.Setup(r => r.TreeViewTag()).Returns(() => rootTag.Object);
            builder.Setup(r => r.ItemTag(It.IsAny <TreeViewItem>(), It.IsAny <bool>())).Returns(() => itemTag.Object);
            builder.Setup(r => r.ItemInnerContent(It.IsAny <TreeViewItem>())).Returns(() => new Mock <IHtmlNode>().Object);
            builder.Setup(r => r.ItemHiddenInputValue(It.IsAny <TreeViewItem>())).Returns(() => new Mock <IHtmlNode>().Object);
            builder.Setup(r => r.ItemContentTag(It.IsAny <TreeViewItem>())).Returns(() => new Mock <IHtmlNode>().Object);
            builder.Setup(r => r.ChildrenTag(It.IsAny <TreeViewItem>())).Returns(() => new Mock <IHtmlNode>().Object);

            treeView      = TreeViewTestHelper.CreateTreeView(writer.Object, builder.Object, objectWriter.Object);
            treeView.Name = "TreeView";
        }
示例#3
0
        public TreeViewRendererTests()
        {
            writer = new Mock <HtmlTextWriter>(TextWriter.Null);

            treeView      = TreeViewTestHelper.CreateTreeView(writer.Object, null, null);
            treeView.Name = "TreeView1";

            item         = new TreeViewItem();
            item.Visible = true;

            builder = new TreeViewHtmlBuilder(treeView, new Mock <IActionMethodCache>().Object);
        }
        public TreeViewSerializationTests()
        {
            textWriter = new Mock <TextWriter>();
            textWriter.Setup(tw => tw.Write(It.IsAny <string>())).Callback <string>(s => output += s);

            var treeViewId = "myTreeView";

            treeview = TreeViewTestHelper.CreateTreeView(
                new Mock <HtmlTextWriter>(TextWriter.Null).Object,
                null,
                new ClientSideObjectWriter(treeViewId, "tTreeView", textWriter.Object)
                );
            treeview.Name = treeViewId;
        }