private bool RunNoThread(int index, TestItem testItem, System.Action <int, TestItem, int> onTestBegin, System.Action <int, TestItem, int, Status> onTestEnd) { var type = testItem.type; var poolMode = ME.ECS.Pools.isActive; ME.ECS.Pools.isActive = false; { var context = new Context() { defaultInstance = System.Activator.CreateInstance(type), targetInstance = System.Activator.CreateInstance(type), instance = System.Activator.CreateInstance(type), testItem = testItem, }; try { this.FillRandom(ref context.targetInstance); } catch (System.Exception ex) { this.SetAllFailed(testItem); UnityEngine.Debug.LogException(ex); return(false); } { try { var methods = type.GetMethods(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic); foreach (var method in methods) { if (method.Name.EndsWith("Recycle") == true && method.GetParameters().Length == 0) { method.Invoke(context.defaultInstance, null); break; } } } catch (System.Exception ex) { this.SetAllFailed(testItem); UnityEngine.Debug.LogException(ex); } } try { this.FillRandom(ref context.instance); } catch (System.Exception ex) { UnityEngine.Debug.LogException(ex); this.SetAllFailed(testItem); return(false); } for (int i = 0; i < testItem.tests.Length; ++i) { var test = testItem.tests[i]; onTestBegin.Invoke(index, testItem, i); { if (this.RunTestByMethod(test.method, context) == true) { test.status = Status.Passed; } else { test.status = Status.Failed; } } onTestEnd.Invoke(index, testItem, i, test.status); } } ME.ECS.Pools.isActive = poolMode; return(true); }