GroupByTestsRenderer.cs 630 B

12345678910111213141516171819202122232425
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using UnityEngine;
  4. namespace UnityTest
  5. {
  6. public class GroupByTestsRenderer : AssertionListRenderer<GameObject>
  7. {
  8. protected override IEnumerable<IGrouping<GameObject, AssertionComponent>> GroupResult (IEnumerable<AssertionComponent> assertionComponents)
  9. {
  10. return assertionComponents.GroupBy (c =>
  11. {
  12. var topGO = TestManager.FindTopGameObject (c.gameObject);
  13. if (topGO.GetComponents<TestComponent> () != null)
  14. return topGO;
  15. return topGO;
  16. });
  17. }
  18. protected override string GetFoldoutDisplayName (GameObject key)
  19. {
  20. return key.name;
  21. }
  22. }
  23. }