mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-07-31 15:58:27 -04:00
* 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
40 lines
858 B
C#
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();
|
|
}
|
|
}
|