상속: IMvcSiteMapProvider
        public MvcSiteMapProviderTests()
        {
            parser = new MvcSiteMapParser();
            config = ConfigurationFactory.Create();
            context = HtmlHelperFactory.CreateHtmlHelper().ViewContext;
            authorizationProvider = Substitute.For<IAuthorizationProvider>();
            siteMap = new MvcSiteMapProvider(config, parser, authorizationProvider);

            route = context.RouteData.Values;
        }
        public void GetSiteMap_NullAuthorization_ReturnsAllMenus()
        {
            siteMap = new MvcSiteMapProvider(config, parser, null);

            MvcSiteMapNode[] actual = siteMap.GetSiteMap(context).ToArray();

            Assert.Equal(1, actual.Length);

            Assert.Null(actual[0].Action);
            Assert.Null(actual[0].Controller);
            Assert.Equal("Administration", actual[0].Area);
            Assert.Equal("fa fa-gears", actual[0].IconClass);

            actual = actual[0].Children.ToArray();

            Assert.Equal(2, actual.Length);

            Assert.Empty(actual[0].Children);

            Assert.Equal("Index", actual[0].Action);
            Assert.Equal("Accounts", actual[0].Controller);
            Assert.Equal("Administration", actual[0].Area);
            Assert.Equal("fa fa-user", actual[0].IconClass);

            Assert.Null(actual[1].Action);
            Assert.Equal("Roles", actual[1].Controller);
            Assert.Equal("Administration", actual[1].Area);
            Assert.Equal("fa fa-users", actual[1].IconClass);

            actual = actual[1].Children.ToArray();

            Assert.Equal(1, actual.Length);
            Assert.Empty(actual[0].Children);

            Assert.Equal("Create", actual[0].Action);
            Assert.Equal("Roles", actual[0].Controller);
            Assert.Equal("Administration", actual[0].Area);
            Assert.Equal("fa fa-file-o", actual[0].IconClass);
        }
        public void GetSiteMap_ActiveMenuParents_SetsHasActiveChildren()
        {
            route["action"] = "Create";
            route["controller"] = "Roles";
            route["area"] = "Administration";

            siteMap = new MvcSiteMapProvider(config, parser, null);

            MvcSiteMapNode[] actual = siteMap.GetSiteMap(context).ToArray();

            Assert.Equal(1, actual.Length);
            Assert.True(actual[0].HasActiveChildren);

            actual = actual[0].Children.ToArray();

            Assert.Equal(2, actual.Length);
            Assert.Empty(actual[0].Children);
            Assert.True(actual[1].HasActiveChildren);
            Assert.False(actual[0].HasActiveChildren);

            actual = actual[1].Children.ToArray();

            Assert.Equal(1, actual.Length);
            Assert.Empty(actual[0].Children);
            Assert.False(actual[0].HasActiveChildren);
        }
        public void GetSiteMap_NonMenuChildrenNodeIsActive_SetsActiveMenu()
        {
            route["action"] = "Edit";
            route["controller"] = "Accounts";
            route["area"] = "Administration";

            siteMap = new MvcSiteMapProvider(config, parser, null);

            MvcSiteMapNode[] actual = siteMap.GetSiteMap(context).ToArray();

            Assert.Equal(1, actual.Length);
            Assert.False(actual[0].IsActive);

            actual = actual[0].Children.ToArray();

            Assert.Equal(2, actual.Length);
            Assert.True(actual[0].IsActive);
            Assert.False(actual[1].IsActive);
            Assert.Empty(actual[0].Children);

            actual = actual[1].Children.ToArray();

            Assert.Equal(1, actual.Length);
            Assert.False(actual[0].IsActive);
            Assert.Empty(actual[0].Children);
        }
 public MvcSiteMapProviderTests()
 {
     requestContext = HttpContextFactory.CreateHttpContext().Request.RequestContext;
     provider = new MvcSiteMapProvider(siteMapPath, parser);
     routeValues = requestContext.RouteData.Values;
 }
 public MvcSiteMapProviderTests()
 {
     viewContext = HtmlHelperFactory.CreateHtmlHelper().ViewContext;
     provider = new MvcSiteMapProvider(siteMapPath, parser);
     routeValues = viewContext.RouteData.Values;
 }
 public MvcSiteMapProviderTests()
 {
     provider = new MvcSiteMapProvider("Mvc.sitemap", new MvcSiteMapParser());
     context = HtmlHelperFactory.CreateHtmlHelper().ViewContext;
     routeValues = context.RouteData.Values;
 }