2
0
mirror of synced 2025-01-12 17:44:08 +00:00
2023-06-21 08:28:40 +02:00

25 lines
714 B
C#

namespace ContinuousTests
{
public class TestFinder
{
private readonly List<IContinuousTest> testList = new List<IContinuousTest>();
public IContinuousTest[] GetTests()
{
if (!testList.Any()) FindTests();
return testList.ToArray();
}
private void FindTests()
{
var types = GetType().Assembly.GetTypes();
var testTypes = types.Where(t => typeof(IContinuousTest).IsAssignableFrom(t) && !t.IsAbstract);
foreach (var testType in testTypes)
{
var t = Activator.CreateInstance(testType);
testList.Add((IContinuousTest)t!);
}
}
}
}