protected override IEnumerable<IGrouping<GameObject, AssertionComponent>> GroupResult (IEnumerable<AssertionComponent> assertionComponents) { return assertionComponents.GroupBy (c => { var topGO = TestManager.FindTopGameObject (c.gameObject); if (topGO.GetComponents<TestComponent> () != null) return topGO; return topGO; }); }
public void OnSelectionChange() { if (isRunning || EditorApplication.isPlayingOrWillChangePlaymode) { return; } if (Selection.objects != null && Selection.objects.All(o => o is GameObject) && Selection.objects.All(o => (o as GameObject).GetComponent <TestComponent>() != null)) { renderer.SelectInHierarchy(Selection.objects.Select(o => o as GameObject)); Repaint(); } if (Selection.activeGameObject != null && Selection.activeGameObject.transform.parent != null) { var testGO = TestManager.FindTopGameObject(Selection.activeGameObject); if (testGO.GetComponent <TestComponent>() != null) { renderer.SelectInHierarchy(new[] { testGO }); } } }
public void RunSelectedTest() { if (Selection.activeGameObject != null) { var activeGO = Selection.activeGameObject; var topActiveGO = TestManager.FindTopGameObject(activeGO); if (topActiveGO.GetComponent <TestComponent>() != null) { RunTests(new List <GameObject>() { topActiveGO }); } else { Debug.LogWarning("Selected object or it's parent has no TestComponent attached."); } } else { Debug.LogWarning("No object is selected"); } }