Пример #1
0
        public MenuBuilderTests()
        {
            Mock <HtmlTextWriter> writer = new Mock <HtmlTextWriter>(TextWriter.Null);

            menu    = MenuTestHelper.CreateMenu(writer.Object, null);
            builder = new MenuBuilder(menu);
        }
        public MenuSerializationTests()
        {
            Mock <HtmlTextWriter> htmlWriter = new Mock <HtmlTextWriter>(TextWriter.Null);

            textWriter = new Mock <TextWriter>();
            textWriter.Setup(tw => tw.Write(It.IsAny <string>())).Callback <string>(s => output += s);

            menu      = MenuTestHelper.CreateMenu(htmlWriter.Object, null);
            menu.Name = "myMenu";
        }
        public MenuHtmlBuilderTests()
        {
            Mock <HtmlTextWriter> writer = new Mock <HtmlTextWriter>(TextWriter.Null);

            menu      = MenuTestHelper.CreateMenu(writer.Object, null);
            menu.Name = "Menu1";

            item = new MenuItem();

            builder = new MenuHtmlBuilder(menu, new Mock <IActionMethodCache>().Object);
        }
Пример #4
0
        public MenuRenderingTests()
        {
            Mock <HtmlTextWriter> writer = new Mock <HtmlTextWriter>(TextWriter.Null);

            builder = new Mock <INavigationComponentHtmlBuilder <MenuItem> >();
            builder.Setup(b => b.Build()).Returns(() => new HtmlElement("ul"));
            builder.Setup(r => r.ItemTag(It.IsAny <MenuItem>())).Returns(() => new HtmlElement("li"));
            builder.Setup(r => r.ItemInnerContentTag(It.IsAny <MenuItem>(), It.IsAny <bool>())).Returns(() => new HtmlElement("a"));
            builder.Setup(r => r.ChildrenTag(It.IsAny <MenuItem>())).Returns(() => new HtmlElement("ul"));

            menu      = MenuTestHelper.CreateMenu(writer.Object, builder.Object);
            menu.Name = "Menu";

            menu.Items.Add(new MenuItem {
                Text = "MenuItem1"
            });
            menu.Items.Add(new MenuItem {
                Text = "MenuItem2"
            });
            menu.Items.Add(new MenuItem {
                Text = "MenuItem3"
            });
        }
 public MenuSettingsVerificationTests()
 {
     menu      = MenuTestHelper.CreateMenu();
     menu.Name = "Menu";
 }