mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-15 01:39:39 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
26 lines
1.0 KiB
C#
26 lines
1.0 KiB
C#
using Microsoft.CodeAnalysis;
|
|
using Microsoft.CodeAnalysis.CodeFixes;
|
|
using Microsoft.CodeAnalysis.CSharp.Testing;
|
|
using Microsoft.CodeAnalysis.Diagnostics;
|
|
using Microsoft.CodeAnalysis.Testing;
|
|
namespace Sandbox.CodeUpgrader;
|
|
|
|
public class FixerTest<T, TFix> : IFixerTest where T : DiagnosticAnalyzer, new() where TFix : CodeFixProvider, new()
|
|
{
|
|
public async Task Test( string oldcode, string fixedcode )
|
|
{
|
|
var test = new CSharpCodeFixTest<T, TFix, DefaultVerifier>
|
|
{
|
|
ReferenceAssemblies = ReferenceAssemblies.NetStandard.NetStandard20,
|
|
TestCode = oldcode,
|
|
FixedCode = fixedcode,
|
|
};
|
|
|
|
test.TestState.AdditionalReferences.Add( MetadataReference.CreateFromFile( typeof( Sandbox.Internal.GlobalGameNamespace ).Assembly.Location ) );
|
|
test.TestState.AdditionalReferences.Add( MetadataReference.CreateFromFile( typeof( Sandbox.ConCmdAttribute ).Assembly.Location ) );
|
|
test.TestState.AdditionalReferences.Add( MetadataReference.CreateFromFile( typeof( NetFlags ).Assembly.Location ) );
|
|
|
|
await test.RunAsync();
|
|
}
|
|
}
|