2023-06-25 07:53:10 +00:00
|
|
|
|
namespace ContinuousTests
|
2023-06-21 06:28:40 +00:00
|
|
|
|
{
|
2023-06-25 07:53:10 +00:00
|
|
|
|
public class ContinuousTestRunner
|
2023-06-21 06:28:40 +00:00
|
|
|
|
{
|
|
|
|
|
private readonly ConfigLoader configLoader = new ConfigLoader();
|
2023-06-21 07:27:59 +00:00
|
|
|
|
private readonly TestFactory testFactory = new TestFactory();
|
2023-06-25 07:53:10 +00:00
|
|
|
|
private readonly Configuration config;
|
|
|
|
|
private readonly StartupChecker startupChecker;
|
2023-06-21 08:06:54 +00:00
|
|
|
|
|
2023-06-25 07:53:10 +00:00
|
|
|
|
public ContinuousTestRunner()
|
2023-06-21 08:06:54 +00:00
|
|
|
|
{
|
2023-06-25 07:53:10 +00:00
|
|
|
|
config = configLoader.Load();
|
|
|
|
|
startupChecker = new StartupChecker(config);
|
2023-06-21 08:06:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-06-25 07:53:10 +00:00
|
|
|
|
public void Run()
|
2023-06-21 06:28:40 +00:00
|
|
|
|
{
|
2023-06-25 07:53:10 +00:00
|
|
|
|
startupChecker.Check();
|
2023-06-21 06:28:40 +00:00
|
|
|
|
|
2023-06-25 07:53:10 +00:00
|
|
|
|
var allTests = testFactory.CreateTests();
|
|
|
|
|
var testStarters = allTests.Select(t => new TestStarter(config, t.GetType(), t.RunTestEvery)).ToArray();
|
2023-06-21 06:28:40 +00:00
|
|
|
|
|
2023-06-25 07:53:10 +00:00
|
|
|
|
foreach (var t in testStarters)
|
2023-06-21 06:28:40 +00:00
|
|
|
|
{
|
2023-06-25 07:53:10 +00:00
|
|
|
|
t.Begin();
|
2023-06-21 06:28:40 +00:00
|
|
|
|
}
|
2023-06-25 07:53:10 +00:00
|
|
|
|
|
2023-06-25 08:50:01 +00:00
|
|
|
|
while (true) Thread.Sleep((2 ^ 31) - 1);
|
2023-06-23 09:38:30 +00:00
|
|
|
|
}
|
2023-06-21 08:06:54 +00:00
|
|
|
|
}
|
2023-06-21 06:28:40 +00:00
|
|
|
|
}
|