Skip to content

Commit ab23501

Browse files
committed
Fix for runtime use
1 parent 28f5be1 commit ab23501

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

Tests/Runtime/Paginators/IPaginatorTest.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
using System;
55
using System.Linq;
6+
using System.Reflection;
67
using NUnit.Framework;
7-
using UnityEditor;
88
using UnityEngine;
99

1010
namespace TestHelper.UI.Paginators
@@ -14,7 +14,25 @@ public class IPaginatorTest
1414
{
1515
private static Type[] GetPaginators()
1616
{
17-
return TypeCache.GetTypesDerivedFrom<IPaginator>().ToArray();
17+
var interfaceType = typeof(IPaginator);
18+
return AppDomain.CurrentDomain.GetAssemblies()
19+
.SelectMany(assembly =>
20+
{
21+
try
22+
{
23+
return assembly.GetTypes();
24+
}
25+
catch (ReflectionTypeLoadException ex)
26+
{
27+
return ex.Types.Where(t => t != null);
28+
}
29+
catch
30+
{
31+
return Enumerable.Empty<Type>();
32+
}
33+
})
34+
.Where(t => t != null && interfaceType.IsAssignableFrom(t) && t.IsClass && !t.IsAbstract)
35+
.ToArray();
1836
}
1937

2038
/// <summary>

0 commit comments

Comments
 (0)