Exemplo n.º 1
0
        public void GetMenus_ReturnsOnlyMenus()
        {
            IEnumerable <MvcSiteMapNode> expected = TreeToEnumerable(GetSiteMap()).Where(node => node.IsMenu);
            IEnumerable <MvcSiteMapNode> actual   = TreeToEnumerable(parser.GetMenuNodes(siteMap));

            expected.Last().Parent  = expected.First();
            expected.First().Parent = null;

            IEnumerable <MvcSiteMapNode> expectedParents = expected.Select(node => node.Parent);
            IEnumerable <MvcSiteMapNode> actualParents   = actual.Select(node => node.Parent);

            TestHelper.EnumPropertyWiseEqual(expectedParents, actualParents);
            TestHelper.EnumPropertyWiseEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void GetMenus_OnNullAuthorizationProviderReturnsAllMenus()
        {
            IEnumerator <MvcSiteMapNode>     expected = parser.GetMenuNodes(siteMap).GetEnumerator();
            IEnumerator <MvcSiteMapMenuNode> actual   = provider.GetMenus().GetEnumerator();

            while (expected.MoveNext() | actual.MoveNext())
            {
                String expectedTitle = ResourceProvider.GetSiteMapTitle(actual.Current.Area, actual.Current.Controller, actual.Current.Action);

                Assert.AreEqual(expected.Current.Controller, actual.Current.Controller);
                Assert.AreEqual(expected.Current.IconClass, actual.Current.IconClass);
                Assert.AreEqual(expected.Current.Action, actual.Current.Action);
                Assert.AreEqual(expected.Current.Area, actual.Current.Area);
                Assert.AreEqual(expectedTitle, actual.Current.Title);
            }
        }