Files
sbox-public/engine/Tests/Sandbox.Test.Unit/System/ErrorReportTest.cs
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

34 lines
727 B
C#

using Sandbox.Engine;
namespace SystemTests;
[TestClass]
public class ErrorReportTest
{
/// <summary>
/// In unit-test builds Sentry is disabled, so Initialize and Flush are
/// guard-clause smoke checks. The one observable side effect headless is
/// that ReportException always increments Application.ExceptionCount.
/// </summary>
[TestMethod]
public void BasicReport()
{
ErrorReporter.Initialize();
var countBefore = Sandbox.Application.ExceptionCount;
try
{
throw new System.Exception( "Unit Test Exception" );
}
catch ( System.Exception e )
{
ErrorReporter.ReportException( e );
}
Assert.AreEqual( countBefore + 1, Sandbox.Application.ExceptionCount );
ErrorReporter.Flush();
}
}