Refactor folder structure
This commit is contained in:
9
src/Test/Ghost.Test.Core/Ghost.Test.Core.csproj
Normal file
9
src/Test/Ghost.Test.Core/Ghost.Test.Core.csproj
Normal file
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
10
src/Test/Ghost.Test.Core/ITest.cs
Normal file
10
src/Test/Ghost.Test.Core/ITest.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Ghost.Test.Core;
|
||||
|
||||
public interface ITest
|
||||
{
|
||||
public void Setup();
|
||||
|
||||
public void Run();
|
||||
|
||||
public void Cleanup();
|
||||
}
|
||||
28
src/Test/Ghost.Test.Core/TestRunner.cs
Normal file
28
src/Test/Ghost.Test.Core/TestRunner.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
namespace Ghost.Test.Core;
|
||||
|
||||
public class TestRunner
|
||||
{
|
||||
public static void Run<T>()
|
||||
where T : ITest, new()
|
||||
{
|
||||
var test = new T();
|
||||
test.Setup();
|
||||
test.Run();
|
||||
test.Cleanup();
|
||||
}
|
||||
|
||||
public static void Run<T>(int iteration)
|
||||
where T : ITest, new()
|
||||
{
|
||||
var test = new T();
|
||||
test.Setup();
|
||||
|
||||
iteration = iteration < 1 ? 1 : iteration;
|
||||
for (var i = 0; i < iteration; i++)
|
||||
{
|
||||
test.Run();
|
||||
}
|
||||
|
||||
test.Cleanup();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user