private static void SetValueWorks <T>(SerializedProperty serializedProperty, PropertyPathInfo.SetValueHandler <T> onSetValue, Func <int, T, bool> onValidate) { serializedProperty.SetValues(onSetValue); T[] values = serializedProperty.GetValues <T>(); for (int i = 0; i < values.Length; i++) { T value = values[i]; Assert.That(onValidate(i, value), Is.True); } }
public static void SetValues <T>(this SerializedProperty property, [NotNull] PropertyPathInfo.SetValueHandler <T> onSetValue) { property.GetPropertyPathInfo().SetValues(property.serializedObject.targetObjects, onSetValue); }
private static void SetValueWorks <T>(SerializedObject serializedObject, string property, string relativeProperty, PropertyPathInfo.SetValueHandler <T> onSetValue, Func <int, T, bool> onValidate) { using (SerializedProperty serializedProperty = serializedObject.FindProperty(property)) { Assert.That(serializedProperty, Is.Not.Null); using (SerializedProperty relativeSerializedProperty = serializedProperty.FindPropertyRelative(relativeProperty)) { Assert.That(relativeSerializedProperty, Is.Not.Null); SetValueWorks(relativeSerializedProperty, onSetValue, onValidate); } } }