public void RemoveAttribute_NonExistentAttribute() { var selectedEntities = new List <IEntity> { new FileEntity("test"), }; _selection .As <IEnumerable>() .Setup(mock => mock.GetEnumerator()) .Returns(selectedEntities.GetEnumerator()); _attributes.RemoveAttribute("attr"); }
public void ListIterator(SerializedProperty listProperty, ref SerializedProperty visible) { Attributes_Debug.boolValue = EditorGUILayout.Toggle(new GUIContent("Debug Mode", "Enables editing attribute points"), Attributes_Debug.boolValue); EditorGUILayout.BeginHorizontal(); visible.boolValue = EditorGUILayout.Foldout(visible.boolValue, listProperty.name, boldFoldOut); if (Button("+", miniButton, GUILayout.Width(20))) { Undo.RecordObject(manager, "Before Attribute Added"); manager.AddAttribute(new Attribute() { Name = string.Format("Attribute{0}", manager.Attributes.Count) }); } EditorGUILayout.EndHorizontal(); if (visible.boolValue) { EditorGUI.indentLevel++; for (int i = 0; i < listProperty.arraySize; i++) { SerializedProperty attribute = listProperty.GetArrayElementAtIndex(i); DrawAttribute(attribute, i); } EditorGUI.indentLevel--; } if (removeAttribute != null) { Undo.RecordObject(manager, "Before Attribute Removed"); manager.RemoveAttribute(removeAttribute); removeAttribute = null; } if (moveFrom >= 0 && moveTo >= 0 && moveFrom != moveTo) { Undo.RecordObject(manager, "Before Attribute Move"); Attribute temp = manager.Attributes[moveTo]; manager.Attributes[moveTo] = manager.Attributes[moveFrom]; manager.Attributes[moveFrom] = temp; } moveFrom = -1; moveTo = -1; }