Files
Garry Newman d95169d8fa Unit Test Cleanup (#5064)
* Move all unit tests to Engine/Tests
* Fix Margin.EdgeSubtract
* Fix Capsule.Contains
* EnvironmentVariables.Remove if it's null
* Fixed ray trace never returning startedsolid
* Fix HistoryList.Navigate on empty list
* Fix GameObject.WorldPosition accepting NaNs
* Fix flex: initial expanding to the wrong grow/shrink
* Translation.TryConvert shouldn't throw on invalid enum strings
* Skip sound file tests on machines with no audio device
2026-06-12 13:23:50 +01:00

40 lines
858 B
C#

namespace EngineTests;
[TestClass]
public class ShutdownTest
{
/// <summary>
/// Shutdown clears global context state (including Surface.All), so after re-initing
/// we must restore the fallback surface that AssemblyInitialize installed - otherwise
/// every trace test that happens to run after this class loses all hits.
/// </summary>
static void Reinit()
{
TestInit.TestAppSystem.Init();
if ( Surface.All.Count == 0 )
{
Surface.All[0] = new Surface();
}
}
[TestMethod]
public void Single()
{
// We already initialized the app for testing, so we can directly shutdown
TestInit.TestAppSystem.Shutdown();
// We need to re-init because other tests still need it
Reinit();
}
[TestMethod]
public void Multiple()
{
TestInit.TestAppSystem.Shutdown();
Reinit();
TestInit.TestAppSystem.Shutdown();
Reinit();
}
}