public void ReturnsNullWhenContextItemIsNull()
        {
            var rootResolver = new NavigationRootResolver();

            var resolvedItem = rootResolver.GetNavigationRoot(null);

            Assert.Null(resolvedItem);
        }
        public void ResolvesWhenContextItemIsGrandchild()
        {
            var contextItem  = _db.GetItem("/sitecore/content/Home/Child/Grandchild");
            var rootResolver = new NavigationRootResolver();

            var resolvedItem = rootResolver.GetNavigationRoot(contextItem);

            Assert.Equal(_rootItem.ID, resolvedItem.ID);
        }
        public void ReturnsNullWhenNoNavigationRoot()
        {
            using (var db = new Db
            {
                new DbItem("Home")
                {
                    new DbItem("Child")
                }
            })
            {
                var contextItem  = _db.GetItem("/sitecore/content/Home/Child");
                var rootResolver = new NavigationRootResolver();

                var resolvedItem = rootResolver.GetNavigationRoot(contextItem);

                Assert.Null(resolvedItem);
            }
        }