public void DiagnoseAndFix()
{
var test = @"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace ConsoleApplication1
{
class Program
{
async Task M()
{
await Task.Delay(1);
}
}
}";
var expected = new DiagnosticResult
{
Id = ConfigureAwaitAnalyzer.DiagnosticId,
Message = "Await used without ConfigureAwait",
Severity = DiagnosticSeverity.Warning,
Locations = new[] { new DiagnosticResultLocation("Test0.cs", 15, 13) }
};
VerifyCSharpDiagnostic(test, expected);
var fixtest = @"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace ConsoleApplication1
{
class Program
{
async Task M()
{
await Task.Delay(1).ConfigureAwait(false);
}
}
}";
VerifyCSharpFix(test, fixtest);
}