mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
50 lines
937 B
C#
50 lines
937 B
C#
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);
|
|
}
|
|
}
|
|
");
|
|
}
|
|
}
|
|
}
|