mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 20:39:01 +00:00
49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using Cosmos.TestRunner.Core;
|
|
|
|
namespace Cosmos.TestRunner.UnitTest
|
|
{
|
|
using Assert = NUnit.Framework.Assert;
|
|
|
|
[TestFixture]
|
|
public class KernelTests
|
|
{
|
|
private static IEnumerable<Type> KernelsToRun => TestKernelSets.GetStableKernelTypes();
|
|
|
|
[TestCaseSource(nameof(KernelsToRun))]
|
|
public void TestKernel(Type aKernelType)
|
|
{
|
|
try
|
|
{
|
|
Directory.SetCurrentDirectory(Path.GetDirectoryName(typeof(KernelTests).Assembly.Location));
|
|
|
|
var xEngine = new Engine(new EngineConfiguration(aKernelType));
|
|
xEngine.OutputHandler = new TestOutputHandler();
|
|
|
|
Assert.IsTrue(xEngine.Execute());
|
|
}
|
|
catch (AssertionException)
|
|
{
|
|
throw;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Console.WriteLine("Exception occurred: " + e.ToString());
|
|
Assert.Fail();
|
|
}
|
|
}
|
|
|
|
private class TestOutputHandler : OutputHandlerFullTextBase
|
|
{
|
|
protected override void Log(string message)
|
|
{
|
|
TestContext.WriteLine(String.Concat(DateTime.Now.ToString("hh:mm:ss.ffffff "), new string(' ', mLogLevel * 2), message));
|
|
}
|
|
}
|
|
}
|
|
}
|