public void getAllUniquesFromObjectType_ReturnsGuids() { EnsureTestDocumentTypes(); var guids = CMSNode.getAllUniquesFromObjectType(new Guid(DocumentTypeObjectTypeId)); var expectedIds = database.Fetch <Guid>( "SELECT uniqueId FROM umbracoNode WHERE nodeObjectType = @ObjectTypeId", new { ObjectTypeId = DocumentTypeObjectTypeId }) .OrderBy(id => id); var actualIds = guids.OrderBy(id => id); Assert.IsTrue(expectedIds.SequenceEqual(actualIds)); }
/// <summary> /// Sets the source content types DropDownList. /// </summary> private void SetSourceContentTypes() { this.contentTypesDropDownList.Items.Clear(); this.contentTypesDropDownList.Items.Add(new ListItem(string.Concat(ui.Text("general", "choose"), "..."), string.Empty)); var value = this.objectTypesDropDownList.SelectedValue; var objectType = Guid.Empty; if (Guid.TryParse(value, out objectType)) { foreach (var guid in CMSNode.getAllUniquesFromObjectType(objectType)) { var node = new CMSNode(guid); this.contentTypesDropDownList.Items.Add(new ListItem(node.Text, node.Id.ToString())); } } }
/// <summary> /// Retrieves a list of all datatypedefinitions /// </summary> /// <returns>A list of all datatypedefinitions</returns> public static DataTypeDefinition[] GetAll() { SortedList retvalSort = new SortedList(); Guid[] tmp = CMSNode.getAllUniquesFromObjectType(_objectType); DataTypeDefinition[] retval = new DataTypeDefinition[tmp.Length]; for (int i = 0; i < tmp.Length; i++) { DataTypeDefinition dt = DataTypeDefinition.GetDataTypeDefinition(tmp[i]); retvalSort.Add(dt.Text + "|||" + Guid.NewGuid().ToString(), dt); } IDictionaryEnumerator ide = retvalSort.GetEnumerator(); int counter = 0; while (ide.MoveNext()) { retval[counter] = (DataTypeDefinition)ide.Value; counter++; } return(retval); }