/// <summary> /// Get the fields that will be tested during TestFields() /// </summary> private List <BaseTestClass> Test_GetFields(TestUtils testUtils) { MonoBehaviour[] scriptComponents = GetComponents <MonoBehaviour>(); List <BaseTestClass> fields = new List <BaseTestClass>(); foreach (MonoBehaviour mono in scriptComponents) { var monoType = mono.GetType(); foreach (var field in monoType.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance)) { var attributes = field.GetCustomAttributes(typeof(TestingFieldAttribute), true); if (attributes.Length > 0) { var fieldValue = field.GetValue(mono) as UnityEngine.Object; var testField = new TestField <UnityEngine.Object>(testUtils, field.Name, fieldValue); fields.Add(testField); } } } return(fields); }
public bool TestField(UnityEngine.Object reference, string fieldName = kDefaultFieldName) { var testField = new TestField <UnityEngine.Object>(this, fieldName, reference); return(testField.Test()); }