Files
sbox-public/engine/Sandbox.CodeUpgrader.Test/Tests/UpgraderTests.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

43 lines
1.5 KiB
C#

using System;
namespace Sandbox.CodeUpgrader;
[TestClass]
public partial class UpgraderTests
{
async Task TestAnalyzer<T>() where T : Analyzer, new()
{
var t = new T();
await t.RunTests( new AnalyzerTest<T>() );
}
async Task TestFixer<T>() where T : Fixer, new()
{
var t = new T();
var testType = typeof( FixerTest<,> ).MakeGenericType( t.Analyzer, t.GetType() );
var test = (IFixerTest)Activator.CreateInstance( testType );
await t.RunTests( test );
}
[TestMethod] public Task BroadcastAttributeAnalyzer() => TestAnalyzer<BroadcastAttributeAnalyzer>();
[TestMethod] public Task BroadcastAttributeFix() => TestFixer<BroadcastAttributeFix>();
[TestMethod] public Task AuthorityAttributeAnalyzer() => TestAnalyzer<AuthorityAttributeAnalyzer>();
[TestMethod] public Task AuthorityAttributeFix() => TestFixer<AuthorityAttributeFix>();
[TestMethod] public Task GpuBufferAnalyzer() => TestAnalyzer<GpuBufferAnalyzer>();
[TestMethod] public Task GpuBufferFix() => TestFixer<GpuBufferFix>();
[TestMethod] public Task ConCmdAttributeAnalyzer() => TestAnalyzer<ConCmdAnalyzer>();
[TestMethod] public Task ConCmdAttributeFix() => TestFixer<ConCmdAttributeFix>();
[TestMethod] public Task ConVarAttributeAnalyzer() => TestAnalyzer<ConVarAnalyzer>();
[TestMethod] public Task ConVarAttributeFix() => TestFixer<ConVarAttributeFix>();
[TestMethod] public Task HotloadUnsupportedAnalyzer() => TestAnalyzer<HotloadUnsupportedAnalyzer>();
[TestMethod] public Task HotloadUnsupportedFix() => TestFixer<HotloadUnsupportedFixer>();
}