mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Implement test code analyzer
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System.Threading.Tasks;
|
||||
using VerifyCS = MakeConst.Test.CSharpCodeFixVerifier<
|
||||
ScriptCoreGenerator.StyleChecker,
|
||||
ScriptCoreGenerator.MakeConstCodeFixProvider>;
|
||||
|
||||
namespace MakeConst.Test
|
||||
{
|
||||
[TestClass]
|
||||
public class MakeConstUnitTest
|
||||
{
|
||||
//No diagnostics expected to show up
|
||||
[TestMethod]
|
||||
public async Task TestEmpty()
|
||||
{
|
||||
var test = @"";
|
||||
|
||||
await VerifyCS.VerifyAnalyzerAsync(test);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task LocalIntCouldBeConstant_Diagnostic()
|
||||
{
|
||||
await VerifyCS.VerifyCodeFixAsync(@"
|
||||
using System;
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
[|int i = 0;|]
|
||||
Console.WriteLine(i);
|
||||
}
|
||||
}
|
||||
", @"
|
||||
using System;
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
const int i = 0;
|
||||
Console.WriteLine(i);
|
||||
}
|
||||
}
|
||||
");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user