提交 7bbf5ec0 编写于 作者: C Cyrus Najmabadi

Dont' need ConfigureAwait(true) in test code.

上级 7d78797e
......@@ -83,7 +83,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeRefactorings
GetMainDocumentAndPreviews(workspace, document, previews)
' The changed document comes first.
Dim preview = Await previews.TakeNextPreviewAsync().ConfigureAwait(True)
Dim preview = Await previews.TakeNextPreviewAsync()
Assert.NotNull(preview)
Assert.True(TypeOf preview Is IWpfDifferenceViewer)
Dim diffView = DirectCast(preview, IWpfDifferenceViewer)
......@@ -92,7 +92,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeRefactorings
diffView.Close()
' The added document comes next.
preview = Await previews.TakeNextPreviewAsync().ConfigureAwait(True)
preview = Await previews.TakeNextPreviewAsync()
Assert.NotNull(preview)
Assert.True(TypeOf preview Is IWpfDifferenceViewer)
diffView = DirectCast(preview, IWpfDifferenceViewer)
......@@ -102,23 +102,23 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeRefactorings
diffView.Close()
' Then comes the removed metadata reference.
preview = Await previews.TakeNextPreviewAsync().ConfigureAwait(True)
preview = Await previews.TakeNextPreviewAsync()
Assert.NotNull(preview)
Assert.True(TypeOf preview Is String)
text = DirectCast(preview, String)
Assert.Contains(s_removedMetadataReferenceDisplayName, text, StringComparison.Ordinal)
' And finally the added project.
preview = Await previews.TakeNextPreviewAsync().ConfigureAwait(True)
preview = Await previews.TakeNextPreviewAsync()
Assert.NotNull(preview)
Assert.True(TypeOf preview Is String)
text = DirectCast(preview, String)
Assert.Contains(s_addedProjectName, text, StringComparison.Ordinal)
' There are no more previews.
preview = Await previews.TakeNextPreviewAsync().ConfigureAwait(True)
preview = Await previews.TakeNextPreviewAsync()
Assert.Null(preview)
preview = Await previews.TakeNextPreviewAsync().ConfigureAwait(True)
preview = Await previews.TakeNextPreviewAsync()
Assert.Null(preview)
End Using
End Function
......@@ -131,14 +131,14 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeRefactorings
GetMainDocumentAndPreviews(workspace, document, previews)
' Should return preview that matches the preferred (added) project.
Dim preview = Await previews.TakeNextPreviewAsync(preferredProjectId:=s_addedProjectId).ConfigureAwait(True)
Dim preview = Await previews.TakeNextPreviewAsync(preferredProjectId:=s_addedProjectId)
Assert.NotNull(preview)
Assert.True(TypeOf preview Is String)
Dim text = DirectCast(preview, String)
Assert.Contains(s_addedProjectName, text, StringComparison.Ordinal)
' Should return preview that matches the preferred (changed) document.
preview = Await previews.TakeNextPreviewAsync(preferredDocumentId:=document.Id).ConfigureAwait(True)
preview = Await previews.TakeNextPreviewAsync(preferredDocumentId:=document.Id)
Assert.NotNull(preview)
Assert.True(TypeOf preview Is IWpfDifferenceViewer)
Dim diffView = DirectCast(preview, IWpfDifferenceViewer)
......@@ -147,7 +147,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeRefactorings
diffView.Close()
' There is no longer a preview for the preferred project. Should return the first remaining preview.
preview = Await previews.TakeNextPreviewAsync(preferredProjectId:=s_addedProjectId).ConfigureAwait(True)
preview = Await previews.TakeNextPreviewAsync(preferredProjectId:=s_addedProjectId)
Assert.NotNull(preview)
Assert.True(TypeOf preview Is IWpfDifferenceViewer)
diffView = DirectCast(preview, IWpfDifferenceViewer)
......@@ -157,16 +157,16 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeRefactorings
diffView.Close()
' There is no longer a preview for the preferred document. Should return the first remaining preview.
preview = Await previews.TakeNextPreviewAsync(preferredDocumentId:=document.Id).ConfigureAwait(True)
preview = Await previews.TakeNextPreviewAsync(preferredDocumentId:=document.Id)
Assert.NotNull(preview)
Assert.True(TypeOf preview Is String)
text = DirectCast(preview, String)
Assert.Contains(s_removedMetadataReferenceDisplayName, text, StringComparison.Ordinal)
' There are no more previews.
preview = Await previews.TakeNextPreviewAsync().ConfigureAwait(True)
preview = Await previews.TakeNextPreviewAsync()
Assert.Null(preview)
preview = Await previews.TakeNextPreviewAsync().ConfigureAwait(True)
preview = Await previews.TakeNextPreviewAsync()
Assert.Null(preview)
End Using
End Function
......
......@@ -166,7 +166,7 @@ index:=1)
NewLines("Imports System \n Imports System.Collections.Generic \n Imports System.Linq \n Class Program \n Sub Main() \n Call New Foo.[|Bar|]() \n End Sub \n End Class"),
NewLines("Namespace Foo \n Friend Class Bar \n Public Sub New() \n End Sub \n End Class \n End Namespace"),
expectedContainers:={"Foo"},
expectedDocumentName:="Bar.vb").ConfigureAwait(True)
expectedDocumentName:="Bar.vb")
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)>
......@@ -175,7 +175,7 @@ expectedDocumentName:="Bar.vb").ConfigureAwait(True)
NewLines("Imports System \n Imports System.Collections.Generic \n Imports System.Linq \n Module Program \n Sub Main(args As String()) \n Dim x As New [|Foo|] \n End Sub \n End Module"),
NewLines("Friend Class Foo \n End Class"),
expectedContainers:=Array.Empty(Of String)(),
expectedDocumentName:="Foo.vb").ConfigureAwait(True)
expectedDocumentName:="Foo.vb")
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)>
......@@ -282,7 +282,7 @@ NewLines("Imports [|System|]"))
NewLines("Class Base \n Sub Main \n Dim p = New [|Derived|]() \n End Sub \n End Class"),
NewLines("Friend Class Derived \n Public Sub New() \n End Sub \n End Class"),
expectedContainers:=Array.Empty(Of String)(),
expectedDocumentName:="Derived.vb").ConfigureAwait(True)
expectedDocumentName:="Derived.vb")
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)>
......
......@@ -137,7 +137,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.LineCommit
End If
Dim realCommitFormatter As New CommitFormatter()
Await realCommitFormatter.CommitRegionAsync(spanToFormat, isExplicitFormat, useSemantics, dirtyRegion, baseSnapshot, baseTree, cancellationToken).ConfigureAwait(True)
Await realCommitFormatter.CommitRegionAsync(spanToFormat, isExplicitFormat, useSemantics, dirtyRegion, baseSnapshot, baseTree, cancellationToken)
End Function
End Class
End Class
......
......@@ -17,20 +17,20 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Squiggles
Private Async Function ProduceSquiggles(ParamArray lines As String()) As Task(Of IEnumerable(Of ITagSpan(Of IErrorTag)))
Using workspace = VisualBasicWorkspaceFactory.CreateWorkspaceFromLines(lines)
Return Await GetErrorSpans(workspace).ConfigureAwait(True)
Return Await GetErrorSpans(workspace)
End Using
End Function
Private Async Function ProduceSquiggles(analyzerMap As Dictionary(Of String, DiagnosticAnalyzer()), ParamArray lines As String()) As Task(Of IEnumerable(Of ITagSpan(Of IErrorTag)))
Using workspace = VisualBasicWorkspaceFactory.CreateWorkspaceFromLines(lines)
Return Await GetErrorSpans(workspace, analyzerMap).ConfigureAwait(True)
Return Await GetErrorSpans(workspace, analyzerMap)
End Using
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.ErrorSquiggles)>
Public Async Sub ErrorTagGeneratedForSimpleError()
' Make sure we have errors from the tree
Dim spans = Await ProduceSquiggles("^").ConfigureAwait(True)
Dim spans = Await ProduceSquiggles("^")
Assert.Equal(1, spans.Count())
Dim firstSpan = spans.First()
......@@ -39,7 +39,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Squiggles
<WpfFact, Trait(Traits.Feature, Traits.Features.ErrorSquiggles)>
Public Async Sub ArgOutOfRangeExceptionBug_904382()
Dim spans = Await ProduceSquiggles("Class C1", "Sub Foo(", "End Class").ConfigureAwait(True)
Dim spans = Await ProduceSquiggles("Class C1", "Sub Foo(", "End Class")
'If the following line does not throw an exception then the test passes.
Dim count = spans.Count
......@@ -51,7 +51,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Squiggles
" Sub Foo()",
" Dim x = <xml>",
" End Sub",
"End Class").ConfigureAwait(True)
"End Class")
Assert.Equal(5, spans.Count())
End Sub
......@@ -61,7 +61,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Squiggles
"Class C1",
" Sub Foo(b as Bar)",
" End Sub",
"End Class").ConfigureAwait(True)
"End Class")
Assert.Equal(1, spans.Count())
Dim firstSpan = spans.First()
......@@ -91,7 +91,7 @@ Class C1
Sub Foo()
Process.Start(GetType(Int32).ToString()) 'Int32 can be simplified.
End Sub
End Class").ConfigureAwait(True)).OrderBy(Function(s) s.Span.Span.Start).ToImmutableArray()
End Class")).OrderBy(Function(s) s.Span.Span.Start).ToImmutableArray()
Assert.Equal(2, spans.Length)
Dim first = spans(0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册