Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
5e31d025
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5e31d025
编写于
11月 18, 2015
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove ConfigureAwait(true) from test code.
上级
7bbf5ec0
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
170 addition
and
170 deletion
+170
-170
src/EditorFeatures/CSharpTest/Classification/SemanticClassifierTests.cs
...ures/CSharpTest/Classification/SemanticClassifierTests.cs
+2
-2
src/EditorFeatures/CSharpTest/Classification/SyntacticTaggerTests.cs
...eatures/CSharpTest/Classification/SyntacticTaggerTests.cs
+2
-2
src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeTests.cs
.../CSharpTest/Diagnostics/GenerateType/GenerateTypeTests.cs
+7
-7
src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeTests_Dialog.cs
...Test/Diagnostics/GenerateType/GenerateTypeTests_Dialog.cs
+94
-94
src/EditorFeatures/CSharpTest/EventHookup/EventHookupCommandHandlerTests.cs
.../CSharpTest/EventHookup/EventHookupCommandHandlerTests.cs
+38
-38
src/EditorFeatures/CSharpTest/Squiggles/ErrorSquiggleProducerTests.cs
...atures/CSharpTest/Squiggles/ErrorSquiggleProducerTests.cs
+13
-13
src/EditorFeatures/CSharpTest/Workspaces/WorkspaceTests.cs
src/EditorFeatures/CSharpTest/Workspaces/WorkspaceTests.cs
+14
-14
未找到文件。
src/EditorFeatures/CSharpTest/Classification/SemanticClassifierTests.cs
浏览文件 @
5e31d025
...
...
@@ -1427,7 +1427,7 @@ public async Task TestCreateWithBufferNotInWorkspace()
edit
.
Apply
();
}
await
waiter
.
CreateWaitTask
()
.
ConfigureAwait
(
true
)
;
await
waiter
.
CreateWaitTask
();
}
}
}
...
...
@@ -1452,7 +1452,7 @@ public async Task TestGetTagsOnBufferTagger()
var
tagger
=
provider
.
CreateTagger
<
IClassificationTag
>(
document
.
TextBuffer
);
using
(
var
disposable
=
(
IDisposable
)
tagger
)
{
await
waiter
.
CreateWaitTask
()
.
ConfigureAwait
(
true
)
;
await
waiter
.
CreateWaitTask
();
var
tags
=
tagger
.
GetTags
(
document
.
TextBuffer
.
CurrentSnapshot
.
GetSnapshotSpanCollection
());
var
allTags
=
tagger
.
GetAllTags
(
document
.
TextBuffer
.
CurrentSnapshot
.
GetSnapshotSpanCollection
(),
CancellationToken
.
None
);
...
...
src/EditorFeatures/CSharpTest/Classification/SyntacticTaggerTests.cs
浏览文件 @
5e31d025
...
...
@@ -42,13 +42,13 @@ public async Task TestTagsChangedForEntireFile()
checkpoint
.
Release
();
};
await
checkpoint
.
Task
.
ConfigureAwait
(
true
)
;
await
checkpoint
.
Task
;
checkpoint
=
new
Checkpoint
();
// Now apply an edit that require us to reclassify more that just the current line
subjectBuffer
.
Insert
(
document
.
CursorPosition
.
Value
,
"\""
);
await
checkpoint
.
Task
.
ConfigureAwait
(
true
)
;
await
checkpoint
.
Task
;
Assert
.
Equal
(
subjectBuffer
.
CurrentSnapshot
.
Length
,
span
.
Length
);
}
}
...
...
src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeTests.cs
浏览文件 @
5e31d025
...
...
@@ -131,7 +131,7 @@ public async Task TestGenerateClassFromFieldDeclarationIntoGlobalNamespace()
@"class Program { void Main ( ) { [|Foo|] f ; } } "
,
@"internal class Foo { } "
,
expectedContainers
:
Array
.
Empty
<
string
>(),
expectedDocumentName
:
"Foo.cs"
)
.
ConfigureAwait
(
true
)
;
expectedDocumentName
:
"Foo.cs"
);
}
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateType
)]
...
...
@@ -141,7 +141,7 @@ public async Task TestGenerateClassFromFieldDeclarationIntoCustomNamespace()
@"class Class { [|TestNamespace|].Foo f; }"
,
@"namespace TestNamespace { internal class Foo { } }"
,
expectedContainers
:
new
List
<
string
>
{
"TestNamespace"
},
expectedDocumentName
:
"Foo.cs"
)
.
ConfigureAwait
(
true
)
;
expectedDocumentName
:
"Foo.cs"
);
}
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateType
)]
...
...
@@ -412,7 +412,7 @@ public async Task TestGenerateClassFromIntoNewNamespace()
@"class Class { static void Main(string[] args) { [|N|].C c; } }"
,
@"namespace N { internal class C { } }"
,
expectedContainers
:
new
List
<
string
>
{
"N"
},
expectedDocumentName
:
"C.cs"
)
.
ConfigureAwait
(
true
)
;
expectedDocumentName
:
"C.cs"
);
}
[
WorkItem
(
538558
)]
...
...
@@ -1025,7 +1025,7 @@ public async Task TestGenerateIntoNewFile()
@"class Class { void F() { new [|Foo|].Bar(); } }"
,
@"namespace Foo { internal class Bar { public Bar() { } } }"
,
expectedContainers
:
new
List
<
string
>
{
"Foo"
},
expectedDocumentName
:
"Bar.cs"
)
.
ConfigureAwait
(
true
)
;
expectedDocumentName
:
"Bar.cs"
);
}
[
WorkItem
(
539620
)]
...
...
@@ -1520,7 +1520,7 @@ public async Task TestAddDocumentForGlobalNamespace()
@"class C : [|Foo|]"
,
"internal class Foo { }"
,
Array
.
Empty
<
string
>(),
"Foo.cs"
)
.
ConfigureAwait
(
true
)
;
"Foo.cs"
);
}
[
WorkItem
(
543886
)]
...
...
@@ -1682,7 +1682,7 @@ public class ClassB
expectedContainers
:
Array
.
Empty
<
string
>(),
expectedDocumentName
:
"ClassB.cs"
,
compareTokens
:
false
,
isLine
:
false
)
.
ConfigureAwait
(
true
)
;
isLine
:
false
);
}
[
WorkItem
(
932602
)]
...
...
@@ -1714,7 +1714,7 @@ public class ClassB
expectedContainers
:
new
List
<
string
>
{
"Namespace1"
,
"Namespace2"
},
expectedDocumentName
:
"ClassB.cs"
,
compareTokens
:
false
,
isLine
:
false
)
.
ConfigureAwait
(
true
)
;
isLine
:
false
);
}
[
WorkItem
(
612700
)]
...
...
src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeTests_Dialog.cs
浏览文件 @
5e31d025
此差异已折叠。
点击以展开。
src/EditorFeatures/CSharpTest/EventHookup/EventHookupCommandHandlerTests.cs
浏览文件 @
5e31d025
...
...
@@ -24,7 +24,7 @@ void M()
using
(
var
testState
=
EventHookupTestState
.
CreateTestState
(
markup
))
{
testState
.
SendTypeChar
(
'='
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"C_MyEvent;"
);
}
}
...
...
@@ -50,7 +50,7 @@ void M()
using
(
var
testState
=
EventHookupTestState
.
CreateTestState
(
markup
))
{
testState
.
SendTypeChar
(
'='
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"Local_MyEvent;"
);
}
}
...
...
@@ -81,7 +81,7 @@ void Foo()
using
(
var
testState
=
EventHookupTestState
.
CreateTestState
(
markup
))
{
testState
.
SendTypeChar
(
'='
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"Cfield_MyEvent;"
);
}
}
...
...
@@ -101,12 +101,12 @@ void Foo()
using
(
var
testState
=
EventHookupTestState
.
CreateTestState
(
markup
))
{
testState
.
SendTypeChar
(
'='
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertNotShowing
();
// Make sure that sending the tab works correctly. Note the 4 spaces after the +=
testState
.
SendTab
();
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
var
expectedCode
=
@"
class C
{
...
...
@@ -142,7 +142,7 @@ private void C_MyEvent()
using
(
var
testState
=
EventHookupTestState
.
CreateTestState
(
markup
))
{
testState
.
SendTypeChar
(
'='
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"C_MyEvent1;"
);
}
}
...
...
@@ -168,7 +168,7 @@ private static void C_MyEvent()
using
(
var
testState
=
EventHookupTestState
.
CreateTestState
(
markup
))
{
testState
.
SendTypeChar
(
'='
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"C_MyEvent1;"
);
}
}
...
...
@@ -190,7 +190,7 @@ void M(string[] args)
using
(
var
testState
=
EventHookupTestState
.
CreateTestState
(
markup
))
{
testState
.
SendTypeChar
(
'='
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"C_MyEvent1;"
);
}
}
...
...
@@ -212,7 +212,7 @@ void Foo()
using
(
var
testState
=
EventHookupTestState
.
CreateTestState
(
markup
))
{
testState
.
SendTypeChar
(
'='
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"C_MyEvent;"
);
}
}
...
...
@@ -232,11 +232,11 @@ void M()
using
(
var
testState
=
EventHookupTestState
.
CreateTestState
(
markup
))
{
testState
.
SendTypeChar
(
'='
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"C_MyEvent;"
);
testState
.
SendTypeChar
(
' '
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"C_MyEvent;"
);
}
}
...
...
@@ -256,11 +256,11 @@ void M()
using
(
var
testState
=
EventHookupTestState
.
CreateTestState
(
markup
))
{
testState
.
SendTypeChar
(
'='
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"C_MyEvent;"
);
testState
.
SendTypeChar
(
'd'
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertNotShowing
();
}
}
...
...
@@ -280,11 +280,11 @@ void M()
using
(
var
testState
=
EventHookupTestState
.
CreateTestState
(
markup
))
{
testState
.
SendTypeChar
(
'='
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"C_MyEvent;"
);
testState
.
SendTypeChar
(
'='
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertNotShowing
();
}
}
...
...
@@ -304,19 +304,19 @@ void M()
using
(
var
testState
=
EventHookupTestState
.
CreateTestState
(
markup
))
{
testState
.
SendTypeChar
(
'='
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"C_MyEvent;"
);
testState
.
SendTypeChar
(
' '
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"C_MyEvent;"
);
testState
.
SendLeftKey
();
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"C_MyEvent;"
);
testState
.
SendLeftKey
();
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertNotShowing
();
}
}
...
...
@@ -336,15 +336,15 @@ void M()
using
(
var
testState
=
EventHookupTestState
.
CreateTestState
(
markup
))
{
testState
.
SendTypeChar
(
'='
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"C_MyEvent;"
);
testState
.
SendTypeChar
(
' '
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"C_MyEvent;"
);
testState
.
SendBackspace
();
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertNotShowing
();
}
}
...
...
@@ -371,7 +371,7 @@ private void C_MyEvent()
{
testState
.
SendTypeChar
(
'='
);
testState
.
SendTab
();
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
var
expectedCode
=
@"
class C
...
...
@@ -419,7 +419,7 @@ private void C_MyEvent()
{
testState
.
SendTypeChar
(
'='
);
testState
.
SendTab
();
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
var
expectedCode
=
@"
class C
...
...
@@ -465,7 +465,7 @@ private void Foo(Action a)
{
testState
.
SendTypeChar
(
'='
);
testState
.
SendTab
();
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
var
expectedCode
=
@"
class C
...
...
@@ -502,7 +502,7 @@ class C
{
testState
.
SendTypeChar
(
'='
);
testState
.
SendTab
();
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
var
expectedCode
=
@"
class C
...
...
@@ -535,7 +535,7 @@ class C
{
testState
.
SendTypeChar
(
'='
);
testState
.
SendTab
();
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
var
expectedCode
=
@"
class C
...
...
@@ -570,7 +570,7 @@ void M()
{
testState
.
SendTypeChar
(
'='
);
testState
.
SendTab
();
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
var
expectedCode
=
@"
class C
...
...
@@ -617,7 +617,7 @@ private void C_MyEvent()
}
testState
.
SendTab
();
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
var
expectedCode
=
@"
class C
...
...
@@ -663,7 +663,7 @@ void M()
testState
.
SendTypeChar
(
'z'
);
testState
.
ReleaseEventHookupCheckMutex
();
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertNotShowing
();
}
}
...
...
@@ -689,7 +689,7 @@ void M()
// tab releases the mutex
testState
.
SendTab
();
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertNotShowing
();
var
expectedCode
=
@"
...
...
@@ -731,7 +731,7 @@ void M()
testState
.
SendLeftKey
();
testState
.
ReleaseEventHookupCheckMutex
();
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertNotShowing
();
}
}
...
...
@@ -759,7 +759,7 @@ private void C_MyEvent()
using
(
var
testState
=
EventHookupTestState
.
CreateTestState
(
markup
))
{
testState
.
SendTypeChar
(
'='
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"C_MyEvent1;"
);
}
}
...
...
@@ -783,7 +783,7 @@ void Main(string[] args)
using
(
var
testState
=
EventHookupTestState
.
CreateTestState
(
markup
))
{
testState
.
SendTypeChar
(
'='
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"Console_CancelKeyPress1;"
);
}
}
...
...
@@ -804,7 +804,7 @@ void M(int C_MyEvent)
using
(
var
testState
=
EventHookupTestState
.
CreateTestState
(
markup
))
{
testState
.
SendTypeChar
(
'='
);
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertShowing
(
"C_MyEvent1;"
);
}
}
...
...
@@ -827,7 +827,7 @@ void M()
{
testState
.
SendTypeChar
(
'='
);
testState
.
SendTab
();
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
var
expectedCode
=
@"
class C
...
...
@@ -865,7 +865,7 @@ void M()
{
testState
.
SendTypeChar
(
'='
);
testState
.
SendTab
();
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
testState
.
AssertNotShowing
();
}
}
...
...
@@ -896,7 +896,7 @@ void Method()
{
testState
.
SendTypeChar
(
'='
);
testState
.
SendTab
();
await
testState
.
WaitForAsynchronousOperationsAsync
()
.
ConfigureAwait
(
true
)
;
await
testState
.
WaitForAsynchronousOperationsAsync
();
var
expectedCode
=
@"
namespace Scenarios
...
...
src/EditorFeatures/CSharpTest/Squiggles/ErrorSquiggleProducerTests.cs
浏览文件 @
5e31d025
...
...
@@ -27,7 +27,7 @@ public class ErrorSquiggleProducerTests : AbstractSquiggleProducerTests
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ErrorSquiggles
)]
public
async
Task
ErrorTagGeneratedForError
()
{
var
spans
=
await
GetErrorSpans
(
"class C {"
)
.
ConfigureAwait
(
true
)
;
var
spans
=
await
GetErrorSpans
(
"class C {"
);
Assert
.
Equal
(
1
,
spans
.
Count
());
var
firstSpan
=
spans
.
First
();
...
...
@@ -37,7 +37,7 @@ public async Task ErrorTagGeneratedForError()
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ErrorSquiggles
)]
public
async
Task
ErrorTagGeneratedForWarning
()
{
var
spans
=
await
GetErrorSpans
(
"class C { long x = 5l; }"
)
.
ConfigureAwait
(
true
)
;
var
spans
=
await
GetErrorSpans
(
"class C { long x = 5l; }"
);
Assert
.
Equal
(
1
,
spans
.
Count
());
Assert
.
Equal
(
PredefinedErrorTypeNames
.
Warning
,
spans
.
First
().
Tag
.
ErrorType
);
}
...
...
@@ -63,7 +63,7 @@ void Test()
using
(
var
workspace
=
TestWorkspaceFactory
.
CreateWorkspace
(
workspaceXml
))
{
var
spans
=
await
GetErrorSpans
(
workspace
)
.
ConfigureAwait
(
true
)
;
var
spans
=
await
GetErrorSpans
(
workspace
);
Assert
.
Equal
(
1
,
spans
.
Count
());
Assert
.
Equal
(
PredefinedErrorTypeNames
.
SyntaxError
,
spans
.
First
().
Tag
.
ErrorType
);
...
...
@@ -110,7 +110,7 @@ void Test()
};
var
spans
=
(
await
GetErrorSpans
(
workspace
,
analyzerMap
)
.
ConfigureAwait
(
true
)
)
(
await
GetErrorSpans
(
workspace
,
analyzerMap
))
.
OrderBy
(
s
=>
s
.
Span
.
Span
.
Start
).
ToImmutableArray
();
Assert
.
Equal
(
3
,
spans
.
Length
);
...
...
@@ -138,14 +138,14 @@ void Test()
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ErrorSquiggles
)]
public
async
Task
ErrorDoesNotCrashPastEOF
()
{
var
spans
=
await
GetErrorSpans
(
"class C { int x ="
)
.
ConfigureAwait
(
true
)
;
var
spans
=
await
GetErrorSpans
(
"class C { int x ="
);
Assert
.
Equal
(
3
,
spans
.
Count
());
}
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ErrorSquiggles
)]
public
async
Task
SemanticErrorReported
()
{
var
spans
=
await
GetErrorSpans
(
"class C : Bar { }"
)
.
ConfigureAwait
(
true
)
;
var
spans
=
await
GetErrorSpans
(
"class C : Bar { }"
);
Assert
.
Equal
(
1
,
spans
.
Count
());
var
firstSpan
=
spans
.
First
();
...
...
@@ -162,7 +162,7 @@ public async Task TestNoErrorsAfterDocumentRemoved()
var
tagger
=
wrapper
.
TaggerProvider
.
CreateTagger
<
IErrorTag
>(
workspace
.
Documents
.
First
().
GetTextBuffer
());
using
(
var
disposable
=
tagger
as
IDisposable
)
{
await
wrapper
.
WaitForTags
()
.
ConfigureAwait
(
true
)
;
await
wrapper
.
WaitForTags
();
var
snapshot
=
workspace
.
Documents
.
First
().
GetTextBuffer
().
CurrentSnapshot
;
var
spans
=
tagger
.
GetTags
(
snapshot
.
GetSnapshotSpanCollection
()).
ToList
();
...
...
@@ -174,7 +174,7 @@ public async Task TestNoErrorsAfterDocumentRemoved()
// Now remove the document.
workspace
.
CloseDocument
(
workspace
.
Documents
.
First
().
Id
);
workspace
.
OnDocumentRemoved
(
workspace
.
Documents
.
First
().
Id
);
await
wrapper
.
WaitForTags
()
.
ConfigureAwait
(
true
)
;
await
wrapper
.
WaitForTags
();
spans
=
tagger
.
GetTags
(
snapshot
.
GetSnapshotSpanCollection
()).
ToList
();
// And we should have no errors for this document.
...
...
@@ -192,7 +192,7 @@ public async Task TestNoErrorsAfterProjectRemoved()
var
tagger
=
wrapper
.
TaggerProvider
.
CreateTagger
<
IErrorTag
>(
workspace
.
Documents
.
First
().
GetTextBuffer
());
using
(
var
disposable
=
tagger
as
IDisposable
)
{
await
wrapper
.
WaitForTags
()
.
ConfigureAwait
(
true
)
;
await
wrapper
.
WaitForTags
();
var
snapshot
=
workspace
.
Documents
.
First
().
GetTextBuffer
().
CurrentSnapshot
;
var
spans
=
tagger
.
GetTags
(
snapshot
.
GetSnapshotSpanCollection
()).
ToList
();
...
...
@@ -205,7 +205,7 @@ public async Task TestNoErrorsAfterProjectRemoved()
workspace
.
CloseDocument
(
workspace
.
Documents
.
First
().
Id
);
workspace
.
OnDocumentRemoved
(
workspace
.
Documents
.
First
().
Id
);
workspace
.
OnProjectRemoved
(
workspace
.
Projects
.
First
().
Id
);
await
wrapper
.
WaitForTags
()
.
ConfigureAwait
(
true
)
;
await
wrapper
.
WaitForTags
();
spans
=
tagger
.
GetTags
(
snapshot
.
GetSnapshotSpanCollection
()).
ToList
();
// And we should have no errors for this document.
...
...
@@ -238,7 +238,7 @@ class Test
CreateDiagnosticData
(
workspace
,
document
,
new
TextSpan
(
0
,
0
)),
CreateDiagnosticData
(
workspace
,
document
,
new
TextSpan
(
0
,
1
))));
var
spans
=
await
GetErrorsFromUpdateSource
(
workspace
,
document
,
updateArgs
)
.
ConfigureAwait
(
true
)
;
var
spans
=
await
GetErrorsFromUpdateSource
(
workspace
,
document
,
updateArgs
);
Assert
.
Equal
(
1
,
spans
.
Count
());
var
first
=
spans
.
First
();
...
...
@@ -271,7 +271,7 @@ class Test
CreateDiagnosticData
(
workspace
,
document
,
new
TextSpan
(
0
,
0
)),
CreateDiagnosticData
(
workspace
,
document
,
new
TextSpan
(
0
,
1
))));
var
spans
=
await
GetErrorsFromUpdateSource
(
workspace
,
document
,
updateArgs
)
.
ConfigureAwait
(
true
)
;
var
spans
=
await
GetErrorsFromUpdateSource
(
workspace
,
document
,
updateArgs
);
Assert
.
Equal
(
2
,
spans
.
Count
());
var
first
=
spans
.
First
();
...
...
@@ -293,7 +293,7 @@ private static async Task<IEnumerable<ITagSpan<IErrorTag>>> GetErrorSpans(params
{
using
(
var
workspace
=
CSharpWorkspaceFactory
.
CreateWorkspaceFromLines
(
content
))
{
return
await
GetErrorSpans
(
workspace
)
.
ConfigureAwait
(
true
)
;
return
await
GetErrorSpans
(
workspace
);
}
}
}
...
...
src/EditorFeatures/CSharpTest/Workspaces/WorkspaceTests.cs
浏览文件 @
5e31d025
...
...
@@ -30,7 +30,7 @@ private static async Task WaitForWorkspaceOperationsToComplete(TestWorkspace wor
var
workspaceWaiter
=
workspace
.
ExportProvider
.
GetExports
<
IAsynchronousOperationListener
,
FeatureMetadata
>()
.
First
(
l
=>
l
.
Metadata
.
FeatureName
==
FeatureAttribute
.
Workspace
).
Value
as
IAsynchronousOperationWaiter
;
await
workspaceWaiter
.
CreateWaitTask
()
.
ConfigureAwait
(
true
)
;
await
workspaceWaiter
.
CreateWaitTask
();
}
[
WpfFact
]
...
...
@@ -42,7 +42,7 @@ public async Task TestEmptySolutionUpdateDoesNotFireEvents()
workspace
.
AddTestProject
(
project
);
// wait for all previous operations to complete
await
WaitForWorkspaceOperationsToComplete
(
workspace
)
.
ConfigureAwait
(
true
)
;
await
WaitForWorkspaceOperationsToComplete
(
workspace
);
var
solution
=
workspace
.
CurrentSolution
;
bool
workspaceChanged
=
false
;
...
...
@@ -53,7 +53,7 @@ public async Task TestEmptySolutionUpdateDoesNotFireEvents()
workspace
.
OnParseOptionsChanged
(
project
.
Id
,
project
.
ParseOptions
);
// wait for any new outstanding operations to complete (there shouldn't be any)
await
WaitForWorkspaceOperationsToComplete
(
workspace
)
.
ConfigureAwait
(
true
)
;
await
WaitForWorkspaceOperationsToComplete
(
workspace
);
// same solution instance == nothing changed
Assert
.
Equal
(
solution
,
workspace
.
CurrentSolution
);
...
...
@@ -486,7 +486,7 @@ public async Task TestGetCompilationOnCrossLanguageDependentProjectChanged()
// this solution should have the change
var
solutionZ
=
workspace
.
CurrentSolution
;
var
docZ
=
solutionZ
.
GetDocument
(
document1
.
Id
);
var
docZText
=
await
docZ
.
GetTextAsync
()
.
ConfigureAwait
(
true
)
;
var
docZText
=
await
docZ
.
GetTextAsync
();
var
compilation2Z
=
solutionZ
.
GetProject
(
id2
).
GetCompilationAsync
().
Result
;
var
classDz
=
compilation2Z
.
SourceModule
.
GlobalNamespace
.
GetTypeMembers
(
"D"
).
Single
();
...
...
@@ -660,14 +660,14 @@ public async Task TestApplyChangesWithDocumentTextUpdated()
workspace
.
OnDocumentOpened
(
document
.
Id
,
document
.
GetOpenTextContainer
());
// prove the document has the correct text
Assert
.
Equal
(
startText
,
(
await
workspace
.
CurrentSolution
.
GetDocument
(
document
.
Id
).
GetTextAsync
()
.
ConfigureAwait
(
true
)
).
ToString
());
Assert
.
Equal
(
startText
,
(
await
workspace
.
CurrentSolution
.
GetDocument
(
document
.
Id
).
GetTextAsync
()).
ToString
());
// fork the solution to introduce a change.
var
oldSolution
=
workspace
.
CurrentSolution
;
var
newSolution
=
oldSolution
.
WithDocumentText
(
document
.
Id
,
SourceText
.
From
(
newText
));
// prove that current document text is unchanged
Assert
.
Equal
(
startText
,
(
await
workspace
.
CurrentSolution
.
GetDocument
(
document
.
Id
).
GetTextAsync
()
.
ConfigureAwait
(
true
)
).
ToString
());
Assert
.
Equal
(
startText
,
(
await
workspace
.
CurrentSolution
.
GetDocument
(
document
.
Id
).
GetTextAsync
()).
ToString
());
// prove buffer is unchanged too
Assert
.
Equal
(
startText
,
buffer
.
CurrentSnapshot
.
GetText
());
...
...
@@ -759,7 +759,7 @@ public async Task TestDocumentEvents()
workspace
.
CloseDocument
(
document
.
Id
);
// Wait for all workspace tasks to finish. After this is finished executing, all handlers should have been notified.
await
WaitForWorkspaceOperationsToComplete
(
workspace
)
.
ConfigureAwait
(
true
)
;
await
WaitForWorkspaceOperationsToComplete
(
workspace
);
// Wait to receive signal that events have fired.
Assert
.
True
(
openWaiter
.
WaitForEventToFire
(
longEventTimeout
),
...
...
@@ -777,7 +777,7 @@ public async Task TestDocumentEvents()
workspace
.
CloseDocument
(
document
.
Id
);
// Wait for all workspace tasks to finish. After this is finished executing, all handlers should have been notified.
await
WaitForWorkspaceOperationsToComplete
(
workspace
)
.
ConfigureAwait
(
true
)
;
await
WaitForWorkspaceOperationsToComplete
(
workspace
);
// Verifying that an event has not been called is difficult to prove.
// All events should have already been called so we wait 5 seconds and then assume the event handler was removed correctly.
...
...
@@ -814,7 +814,7 @@ public async Task TestAdditionalFile_Properties()
var
additionalDocument
=
project
.
GetAdditionalDocument
(
additionalDoc
.
Id
);
Assert
.
Equal
(
"some text"
,
(
await
additionalDocument
.
GetTextAsync
()
.
ConfigureAwait
(
true
)
).
ToString
());
Assert
.
Equal
(
"some text"
,
(
await
additionalDocument
.
GetTextAsync
()).
ToString
());
}
}
...
...
@@ -834,7 +834,7 @@ public async Task TestAdditionalFile_DocumentChanged()
workspace
.
OnAdditionalDocumentOpened
(
additionalDoc
.
Id
,
additionalDoc
.
GetOpenTextContainer
());
var
project
=
workspace
.
CurrentSolution
.
Projects
.
Single
();
var
oldVersion
=
await
project
.
GetSemanticVersionAsync
()
.
ConfigureAwait
(
true
)
;
var
oldVersion
=
await
project
.
GetSemanticVersionAsync
();
// fork the solution to introduce a change.
var
oldSolution
=
workspace
.
CurrentSolution
;
...
...
@@ -847,8 +847,8 @@ public async Task TestAdditionalFile_DocumentChanged()
Assert
.
Equal
(
newText
,
buffer
.
CurrentSnapshot
.
GetText
());
// Text changes are considered top level changes and they change the project's semantic version.
Assert
.
Equal
(
await
doc
.
GetTextVersionAsync
()
.
ConfigureAwait
(
true
),
await
doc
.
GetTopLevelChangeTextVersionAsync
().
ConfigureAwait
(
true
));
Assert
.
NotEqual
(
oldVersion
,
await
doc
.
Project
.
GetSemanticVersionAsync
()
.
ConfigureAwait
(
true
)
);
Assert
.
Equal
(
await
doc
.
GetTextVersionAsync
()
,
await
doc
.
GetTopLevelChangeTextVersionAsync
(
));
Assert
.
NotEqual
(
oldVersion
,
await
doc
.
Project
.
GetSemanticVersionAsync
());
}
}
...
...
@@ -865,8 +865,8 @@ public async Task TestAdditionalFile_OpenClose()
workspace
.
AddTestProject
(
project1
);
var
buffer
=
additionalDoc
.
GetTextBuffer
();
var
doc
=
workspace
.
CurrentSolution
.
GetAdditionalDocument
(
additionalDoc
.
Id
);
var
text
=
await
doc
.
GetTextAsync
(
CancellationToken
.
None
)
.
ConfigureAwait
(
true
)
;
var
version
=
await
doc
.
GetTextVersionAsync
(
CancellationToken
.
None
)
.
ConfigureAwait
(
true
)
;
var
text
=
await
doc
.
GetTextAsync
(
CancellationToken
.
None
);
var
version
=
await
doc
.
GetTextVersionAsync
(
CancellationToken
.
None
);
workspace
.
OnAdditionalDocumentOpened
(
additionalDoc
.
Id
,
additionalDoc
.
GetOpenTextContainer
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录