public void ItemViewModelExtensions_ChildItems_ReturnsChildren()
        {
            var dynamicContentModel = new DynamicContentModel();
            var rootContentType = TypeResolutionService.ResolveType(DynamicWidgetsHierarchicalContentTests.RootContentTypeName);

            dynamicContentModel.ContentType = rootContentType;

            var manager = DynamicModuleManager.GetManager();
            var viewModel = dynamicContentModel.CreateDetailsViewModel(manager.GetDataItems(rootContentType).First());

            var result = viewModel.Item.ChildItems("Child1Types");

            Assert.IsNotNull(result, "ChildItems returned null when there should have been child items enumerable.");
            Assert.AreEqual(2, result.Count(), "ChildItems did not return the expected number of child items.");
        }
        public void ItemViewModelExtensions_ParentItem_ReturnsParentItem()
        {
            var dynamicContentModel = new DynamicContentModel();
            var child1Type = TypeResolutionService.ResolveType(DynamicWidgetsHierarchicalContentTests.Child1TypeName);
            var rootContentType = TypeResolutionService.ResolveType(DynamicWidgetsHierarchicalContentTests.RootContentTypeName);

            dynamicContentModel.ContentType = child1Type;

            var manager = DynamicModuleManager.GetManager();
            var viewModel = dynamicContentModel.CreateDetailsViewModel(manager.GetDataItems(child1Type).First());

            var result = viewModel.Item.ParentItem();

            Assert.IsNotNull(result, "ParentItem returned null when there should have been a parent item.");
            Assert.IsAssignableFrom(rootContentType, result.DataItem.GetType(), "The ParentItem result did not contain a DataItem of the expected type.");
        }