コード例 #1
0
        public void TestFixtureSetUp()
        {
            siteMapPath = "MvcSiteMapProviderTests.sitemap";
            parser      = new MvcSiteMapParser();
            siteMap     = CreateSiteMap();
            siteMap.Save(siteMapPath);

            siteMapTree = parser.GetNodeTree(siteMap);
        }
コード例 #2
0
        public void GetNodes_ReturnsAllSiteMapNodes()
        {
            IEnumerator <MvcSiteMapNode> actual   = TreeToEnumerable(parser.GetNodeTree(siteMap)).GetEnumerator();
            IEnumerator <MvcSiteMapNode> expected = TreeToEnumerable(GetExpectedNodeTree()).GetEnumerator();

            while (expected.MoveNext() | actual.MoveNext())
            {
                Assert.AreEqual(expected.Current.Controller, actual.Current.Controller);
                Assert.AreEqual(expected.Current.IconClass, actual.Current.IconClass);
                Assert.AreEqual(expected.Current.IsMenu, actual.Current.IsMenu);
                Assert.AreEqual(expected.Current.Action, actual.Current.Action);
                Assert.AreEqual(expected.Current.Area, actual.Current.Area);

                if (expected.Current.Parent != null || actual.Current.Parent != null)
                {
                    Assert.AreEqual(expected.Current.Parent.Controller, actual.Current.Parent.Controller);
                    Assert.AreEqual(expected.Current.Parent.IconClass, actual.Current.Parent.IconClass);
                    Assert.AreEqual(expected.Current.Parent.IsMenu, actual.Current.Parent.IsMenu);
                    Assert.AreEqual(expected.Current.Parent.Action, actual.Current.Parent.Action);
                    Assert.AreEqual(expected.Current.Parent.Area, actual.Current.Parent.Area);
                }
            }
        }