提交 849bbc15 编写于 作者: C Cyrus Najmabadi

Make tests async.

上级 25ef659c
......@@ -90,7 +90,7 @@ class C
public async Task DiagnosticAnalyzerDriverIsSafeAgainstAnalyzerExceptions()
{
var source = TestResource.AllInOneCSharpCode;
using (var workspace = CSharpWorkspaceFactory.CreateWorkspaceFromFile(source, TestOptions.Regular))
using (var workspace = await CSharpWorkspaceFactory.CreateWorkspaceFromFileAsync(source, TestOptions.Regular))
{
var document = workspace.CurrentSolution.Projects.Single().Documents.Single();
await ThrowingDiagnosticAnalyzer<SyntaxKind>.VerifyAnalyzerEngineIsSafeAgainstExceptionsAsync(async analyzer =>
......
......@@ -186,12 +186,10 @@ void Method()
TextSpan span;
var document = GetDocumentAndSelectSpan(workspace, out span);
var diagnostics = diagnosticService.GetDiagnosticsForSpanAsync(document, span)
.WaitAndGetResult(CancellationToken.None);
var diagnostics = await diagnosticService.GetDiagnosticsForSpanAsync(document, span);
Assert.Equal(2, diagnostics.Where(d => d.Id == "CS0219").Count());
var allFixes = fixService.GetFixesAsync(document, span, includeSuppressionFixes: true, cancellationToken: CancellationToken.None)
.WaitAndGetResult(CancellationToken.None)
var allFixes = (await fixService.GetFixesAsync(document, span, includeSuppressionFixes: true, cancellationToken: CancellationToken.None))
.SelectMany(fixCollection => fixCollection.Fixes);
var cs0219Fixes = allFixes.Where(fix => fix.PrimaryDiagnostic.Id == "CS0219");
......
......@@ -63,7 +63,7 @@ End Class
<WorkItem(759)>
Public Async Function DiagnosticAnalyzerDriverIsSafeAgainstAnalyzerExceptions() As Task
Dim source = TestResource.AllInOneVisualBasicCode
Using Workspace = VisualBasicWorkspaceFactory.CreateWorkspaceFromFile(source)
Using Workspace = Await VisualBasicWorkspaceFactory.CreateWorkspaceFromFileAsync(source)
Dim document = Workspace.CurrentSolution.Projects.Single().Documents.Single()
Await ThrowingDiagnosticAnalyzer(Of SyntaxKind).VerifyAnalyzerEngineIsSafeAgainstExceptionsAsync(
Async Function(analyzer) Await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(analyzer, document, New TextSpan(0, document.GetTextAsync().Result.Length), logAnalyzerExceptionAsDiagnostics:=True))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册