public void CanReadNodesFromTheDefaultFileIfItIsPresent()
 {
     var reader = new YamlSiteMapReader();
     var nodes = reader.GetAllNodes();
     Assert.IsNotNull( nodes );
     Assert.AreEqual( 8, nodes.Count() );
 }
        public void ParentInfoIsPopulatedProperlyForParents()
        {
            var reader = new YamlSiteMapReader();
            var nodes = reader.GetAllNodes();

            Assert.AreEqual( 0, nodes.First().ParentId );
            Assert.AreEqual( 0, nodes.Single( x => x.Id == 4 ).ParentId );
        }
        public void RolesAreParsedProperly()
        {
            var reader = new YamlSiteMapReader();
            var nodes = reader.GetAllNodes();

            Assert.AreEqual( "Pro", nodes.First().Role );
            Assert.AreEqual( "Pro", nodes.Single( x => x.Id == 3 ).Role );
            Assert.AreEqual( "Anonymous", nodes.Single( x => x.Id == 7 ).Role );
            Assert.AreEqual( "Anon", nodes.Single( x => x.Id == 8 ).Role );
        }
        public void ParentInfoIsPopulatedProperly()
        {
            var reader = new YamlSiteMapReader();
            var nodes = reader.GetAllNodes();

            var node = nodes.Single( x => x.Title == "About" );
            Assert.AreEqual( 1, node.ParentId );

            node = nodes.Single( x => x.Title == "Add" );
            Assert.AreEqual( 4, node.ParentId );
        }
예제 #5
0
        public static void Configure( string filename )
        {
            string filePath = filename;

            if ( !File.Exists( filePath ) ) {
                filePath = Path.Combine( Path.Combine( System.AppDomain.CurrentDomain.BaseDirectory, "bin" ), filename );
            }
            if ( !File.Exists( filePath ) ) {
                filePath = Path.Combine( Directory.GetCurrentDirectory(), filename );
            }

            ISiteMapReader siteMapReader = new YamlSiteMapReader( filePath );
            Configure( siteMapReader );
        }
        public void CanReadNodesFromACustomYamlFile()
        {
            var reader = new YamlSiteMapReader( "sitemap.yaml" );
            var nodes = reader.GetAllNodes();

            var home = nodes.First();
            Assert.AreEqual( "Home", home.Title );
            Assert.AreEqual( "home", home.Controller );
            Assert.AreEqual( "index", home.Action );
            Assert.AreEqual( 1, home.Id );

            var second = nodes.Single( x => x.Title == "About" );
            Assert.AreEqual( 2, second.Id );
        }