Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
15456cdb
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,发现更多精彩内容 >>
提交
15456cdb
编写于
11月 19, 2015
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make more tests async.
上级
b26ab8d4
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
198 addition
and
196 deletion
+198
-196
src/EditorFeatures/Test2/NavigationBar/CSharpNavigationBarTests.vb
...rFeatures/Test2/NavigationBar/CSharpNavigationBarTests.vb
+52
-51
src/EditorFeatures/Test2/NavigationBar/TestHelpers.vb
src/EditorFeatures/Test2/NavigationBar/TestHelpers.vb
+16
-16
src/EditorFeatures/Test2/NavigationBar/VisualBasicNavigationBarTests.vb
...ures/Test2/NavigationBar/VisualBasicNavigationBarTests.vb
+130
-129
未找到文件。
src/EditorFeatures/Test2/NavigationBar/CSharpNavigationBarTests.vb
浏览文件 @
15456cdb
...
...
@@ -7,25 +7,26 @@ Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports
Microsoft.CodeAnalysis.Text
Imports
Roslyn.Test.Utilities
Imports
Roslyn.Utilities
Imports
System.Threading.Tasks
#
Disable
Warning
RS0007
' Avoid zero-length array allocations. This is non-shipping test code.
Namespace
Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
Partial
Public
Class
CSharpNavigationBarTests
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NavigationBar
),
WorkItem
(
545021
)
>
Public
Sub
GenericTypeVariance
()
A
ssertItemsAre
(
Public
Async
Function
TestGenericTypeVariance
()
As
Task
A
wait
AssertItemsAreAsync
(
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
><
!
[
CDATA
[
interface
C
<
in
I
,
out
O
>
{
}
]]
></
Document
>
</
Project
>
</
Workspace
>
,
Item
(
"C<in I, out O>"
,
Glyph
.
InterfaceInternal
,
children
:
=
{}))
End
Sub
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NavigationBar
),
WorkItem
(
545284
)
>
Public
Sub
GenericMember
()
A
ssertItemsAre
(
Public
Async
Function
TestGenericMember
()
As
Task
A
wait
AssertItemsAreAsync
(
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
><
!
[
CDATA
[
class
Program
{
static
void
Swap
<
T
>
(
T
lhs
,
T
rhs
)
{
}}
]]
></
Document
>
...
...
@@ -33,11 +34,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
</
Workspace
>
,
Item
(
"Program"
,
Glyph
.
ClassInternal
,
children
:
=
{
Item
(
"Swap<T>(T lhs, T rhs)"
,
Glyph
.
MethodPrivate
)}))
End
Sub
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NavigationBar
),
WorkItem
(
545023
)
>
Public
Sub
NestedClasses
()
A
ssertItemsAre
(
Public
Async
Function
TestNestedClasses
()
As
Task
A
wait
AssertItemsAreAsync
(
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
class
C
{
class
Nested
{
}
}
</
Document
>
...
...
@@ -45,11 +46,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
</
Workspace
>
,
Item
(
"C"
,
Glyph
.
ClassInternal
,
children
:
=
{}),
Item
(
"C.Nested"
,
Glyph
.
ClassPrivate
,
children
:
=
{}))
End
Sub
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NavigationBar
),
WorkItem
(
545023
)
>
Public
Sub
SelectedItemForNestedClass
()
A
ssertSelectedItemsAre
(
Public
Async
Function
TestSelectedItemForNestedClass
()
As
Task
A
wait
AssertSelectedItemsAreAsync
(
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
class
C
{
class
Nested
{
$$
}
}
</
Document
>
...
...
@@ -57,11 +58,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
</
Workspace
>
,
Item
(
"C.Nested"
,
Glyph
.
ClassPrivate
),
False
,
Nothing
,
False
)
End
Sub
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NavigationBar
),
WorkItem
(
545019
)
>
Public
Sub
SelectedItemForEnumAfterComma
()
A
ssertSelectedItemsAre
(
Public
Async
Function
TestSelectedItemForEnumAfterComma
()
As
Task
A
wait
AssertSelectedItemsAreAsync
(
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
enum
E
{
A
,
$$
B
}
</
Document
>
...
...
@@ -69,11 +70,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
</
Workspace
>
,
Item
(
"E"
,
Glyph
.
EnumInternal
),
False
,
Item
(
"A"
,
Glyph
.
EnumMember
),
False
)
End
Sub
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NavigationBar
),
WorkItem
(
545114
)
>
Public
Sub
SelectedItemForFieldAfterSemicolon
()
A
ssertSelectedItemsAre
(
Public
Async
Function
TestSelectedItemForFieldAfterSemicolon
()
As
Task
A
wait
AssertSelectedItemsAreAsync
(
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
class
C
{
int
foo
;$$
}
</
Document
>
...
...
@@ -81,11 +82,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
</
Workspace
>
,
Item
(
"C"
,
Glyph
.
ClassInternal
),
False
,
Item
(
"foo"
,
Glyph
.
FieldPrivate
),
False
)
End
Sub
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NavigationBar
),
WorkItem
(
545114
)
>
Public
Sub
SelectedItemForFieldInType
()
A
ssertSelectedItemsAre
(
Public
Async
Function
TestSelectedItemForFieldInType
()
As
Task
A
wait
AssertSelectedItemsAreAsync
(
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
class
C
{
in$
$
t
foo
;
}
</
Document
>
...
...
@@ -93,11 +94,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
</
Workspace
>
,
Item
(
"C"
,
Glyph
.
ClassInternal
),
False
,
Item
(
"foo"
,
Glyph
.
FieldPrivate
),
False
)
End
Sub
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NavigationBar
),
WorkItem
(
545267
)
>
Public
Sub
SelectedItemAtEndOfFile
()
A
ssertSelectedItemsAre
(
Public
Async
Function
TestSelectedItemAtEndOfFile
()
As
Task
A
wait
AssertSelectedItemsAreAsync
(
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
class
C
{
int
foo
;
}
$$
</
Document
>
...
...
@@ -105,11 +106,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
</
Workspace
>
,
Item
(
"C"
,
Glyph
.
ClassInternal
),
True
,
Item
(
"foo"
,
Glyph
.
FieldPrivate
),
True
)
End
Sub
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NavigationBar
),
WorkItem
(
545012
)
>
Public
Sub
ExplicitInterfaceImplementation
()
A
ssertItemsAre
(
Public
Async
Function
TestExplicitInterfaceImplementation
()
As
Task
A
wait
AssertItemsAreAsync
(
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
...
...
@@ -120,11 +121,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
</
Workspace
>
,
Item
(
"C"
,
Glyph
.
ClassInternal
,
children
:
=
{
Item
(
"IDisposable.Dispose()"
,
Glyph
.
MethodPrivate
)}))
End
Sub
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NavigationBar
),
WorkItem
(
545007
)
>
Public
Sub
RefAndOutParameters
()
A
ssertItemsAre
(
Public
Async
Function
TestRefAndOutParameters
()
As
Task
A
wait
AssertItemsAreAsync
(
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
...
...
@@ -134,11 +135,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
</
Workspace
>
,
Item
(
"C"
,
Glyph
.
ClassInternal
,
children
:
=
{
Item
(
"M(out string foo, ref string bar)"
,
Glyph
.
MethodPrivate
)}))
End
Sub
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NavigationBar
),
WorkItem
(
545001
)
>
Public
Sub
OptionalParameter
()
A
ssertItemsAre
(
Public
Async
Function
TestOptionalParameter
()
As
Task
A
wait
AssertItemsAreAsync
(
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
...
...
@@ -148,11 +149,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
</
Workspace
>
,
Item
(
"C"
,
Glyph
.
ClassInternal
,
children
:
=
{
Item
(
"M(int i = 0)"
,
Glyph
.
MethodPrivate
)}))
End
Sub
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NavigationBar
),
WorkItem
(
545274
)
>
Public
Sub
Properties
()
A
ssertItemsAre
(
Public
Async
Function
TestProperties
()
As
Task
A
wait
AssertItemsAreAsync
(
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
...
...
@@ -162,11 +163,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
</
Workspace
>
,
Item
(
"C"
,
Glyph
.
ClassInternal
,
children
:
=
{
Item
(
"Number"
,
Glyph
.
PropertyPrivate
)}))
End
Sub
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NavigationBar
),
WorkItem
(
545220
)
>
Public
Sub
[
Enum
]
()
A
ssertItemsAre
(
Public
Async
Function
TestEnum
()
As
Task
A
wait
AssertItemsAreAsync
(
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
...
...
@@ -178,11 +179,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
Item
(
"A"
,
Glyph
.
EnumMember
),
Item
(
"B"
,
Glyph
.
EnumMember
),
Item
(
"C"
,
Glyph
.
EnumMember
)}))
End
Sub
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NavigationBar
),
WorkItem
(
545220
)
>
Public
Sub
[
Delegate
]
()
A
ssertItemsAre
(
Public
Async
Function
TestDelegate
()
As
Task
A
wait
AssertItemsAreAsync
(
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
...
...
@@ -191,11 +192,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
</
Project
>
</
Workspace
>
,
Item
(
"Foo"
,
Glyph
.
DelegateInternal
,
children
:
=
{}))
End
Sub
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NavigationBar
),
WorkItem
(
545114
)
>
Public
Sub
PartialClassWithFieldInOtherFile
()
A
ssertSelectedItemsAre
(
Public
Async
Function
TestPartialClassWithFieldInOtherFile
()
As
Task
A
wait
AssertSelectedItemsAreAsync
(
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
partial
class
C
{
$$
}
</
Document
>
...
...
@@ -204,11 +205,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
</
Workspace
>
,
Item
(
"C"
,
Glyph
.
ClassInternal
),
False
,
Item
(
"foo"
,
Glyph
.
FieldPrivate
,
grayed
:
=
True
),
True
)
End
Sub
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NavigationBar
),
WorkItem
(
578100
)
>
Public
Sub
PartialClassWithBothPartialMethodParts1
()
A
ssertItemsAre
(
Public
Async
Function
TestPartialClassWithBothPartialMethodParts1
()
As
Task
A
wait
AssertItemsAreAsync
(
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
partial
class
C
{
$$
partial
void
M
()
;
}
</
Document
>
...
...
@@ -218,11 +219,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
Item
(
"C"
,
Glyph
.
ClassInternal
,
children
:
=
{
Item
(
"M()"
,
Glyph
.
MethodPrivate
),
Item
(
"M()"
,
Glyph
.
MethodPrivate
,
grayed
:
=
True
)}))
End
Sub
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NavigationBar
),
WorkItem
(
578100
)
>
Public
Sub
PartialClassWithBothPartialMethodParts2
()
A
ssertItemsAre
(
Public
Async
Function
TestPartialClassWithBothPartialMethodParts2
()
As
Task
A
wait
AssertItemsAreAsync
(
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
partial
class
C
{
partial
void
M
()
;
}
</
Document
>
...
...
@@ -232,6 +233,6 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
Item
(
"C"
,
Glyph
.
ClassInternal
,
children
:
=
{
Item
(
"M()"
,
Glyph
.
MethodPrivate
),
Item
(
"M()"
,
Glyph
.
MethodPrivate
,
grayed
:
=
True
)}))
End
Sub
End
Function
End
Class
End
Namespace
src/EditorFeatures/Test2/NavigationBar/TestHelpers.vb
浏览文件 @
15456cdb
...
...
@@ -16,12 +16,12 @@ Imports Roslyn.Utilities
Namespace
Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
Friend
Module
TestHelpers
Public
Sub
AssertItemsAre
(
workspaceElement
As
XElement
,
ParamArray
expectedItems
As
ExpectedItem
())
AssertItemsAre
(
workspaceElement
,
True
,
expectedItems
)
End
Sub
Public
Function
AssertItemsAreAsync
(
workspaceElement
As
XElement
,
ParamArray
expectedItems
As
ExpectedItem
())
As
Tasks
.
Task
Return
AssertItemsAreAsync
(
workspaceElement
,
True
,
expectedItems
)
End
Function
Public
Sub
AssertItemsAre
(
workspaceElement
As
XElement
,
workspaceSupportsChangeDocument
As
Boolean
,
ParamArray
expectedItems
As
ExpectedItem
())
Using
workspace
=
TestWorkspaceFactory
.
CreateWorkspace
(
workspaceElement
)
Public
Async
Function
AssertItemsAreAsync
(
workspaceElement
As
XElement
,
workspaceSupportsChangeDocument
As
Boolean
,
ParamArray
expectedItems
As
ExpectedItem
())
As
Tasks
.
Task
Using
workspace
=
Await
TestWorkspaceFactory
.
CreateWorkspaceAsync
(
workspaceElement
)
workspace
.
CanApplyChangeDocument
=
workspaceSupportsChangeDocument
Dim
document
=
workspace
.
CurrentSolution
.
Projects
.
First
().
Documents
.
First
()
...
...
@@ -33,10 +33,10 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
AssertEqual
(
expectedItems
,
actualItems
,
document
.
Project
.
LanguageServices
.
GetService
(
Of
ISyntaxFactsService
)().
IsCaseSensitive
)
End
Using
End
Sub
End
Function
Public
Sub
AssertSelectedItemsAre
(
workspaceElement
As
XElement
,
leftItem
As
ExpectedItem
,
leftItemGrayed
As
Boolean
,
rightItem
As
ExpectedItem
,
rightItemGrayed
As
Boolean
)
Using
workspace
=
TestWorkspaceFactory
.
CreateWorkspace
(
workspaceElement
)
Public
Async
Function
AssertSelectedItemsAreAsync
(
workspaceElement
As
XElement
,
leftItem
As
ExpectedItem
,
leftItemGrayed
As
Boolean
,
rightItem
As
ExpectedItem
,
rightItemGrayed
As
Boolean
)
As
Tasks
.
Task
Using
workspace
=
Await
TestWorkspaceFactory
.
CreateWorkspaceAsync
(
workspaceElement
)
Dim
document
=
workspace
.
CurrentSolution
.
Projects
.
First
().
Documents
.
First
()
Dim
snapshot
=
document
.
GetTextAsync
().
Result
.
FindCorrespondingEditorTextSnapshot
()
...
...
@@ -55,10 +55,10 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
AssertEqual
(
rightItem
,
selectedItems
.
MemberItem
,
isCaseSensitive
)
Assert
.
Equal
(
rightItemGrayed
,
selectedItems
.
ShowMemberItemGrayed
)
End
Using
End
Sub
End
Function
Public
Sub
AssertGeneratedResultIs
(
workspaceElement
As
XElement
,
leftItemToSelectText
As
String
,
rightItemToSelectText
As
String
,
expectedText
As
XElement
)
Using
workspace
=
TestWorkspaceFactory
.
CreateWorkspace
(
workspaceElement
)
Public
Async
Function
AssertGeneratedResultIsAsync
(
workspaceElement
As
XElement
,
leftItemToSelectText
As
String
,
rightItemToSelectText
As
String
,
expectedText
As
XElement
)
As
Tasks
.
Task
Using
workspace
=
Await
TestWorkspaceFactory
.
CreateWorkspaceAsync
(
workspaceElement
)
Dim
document
=
workspace
.
CurrentSolution
.
Projects
.
First
().
Documents
.
First
()
Dim
snapshot
=
document
.
GetTextAsync
().
Result
.
FindCorrespondingEditorTextSnapshot
()
...
...
@@ -78,15 +78,15 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
Dim
expected
=
expectedText
.
NormalizedValue
.
TrimEnd
()
Assert
.
Equal
(
expected
,
actual
)
End
Using
End
Sub
End
Function
Public
Sub
AssertNavigationPoint
(
workspaceElement
As
XElement
,
Public
Async
Function
AssertNavigationPointAsync
(
workspaceElement
As
XElement
,
startingDocumentFilePath
As
String
,
leftItemToSelectText
As
String
,
rightItemToSelectText
As
String
,
Optional
expectedVirtualSpace
As
Integer
=
0
)
Optional
expectedVirtualSpace
As
Integer
=
0
)
As
Tasks
.
Task
Using
workspace
=
TestWorkspaceFactory
.
CreateWorkspace
(
workspaceElement
)
Using
workspace
=
Await
TestWorkspaceFactory
.
CreateWorkspaceAsync
(
workspaceElement
)
Dim
sourceDocument
=
workspace
.
CurrentSolution
.
Projects
.
First
().
Documents
.
First
(
Function
(
doc
)
doc
.
FilePath
=
startingDocumentFilePath
)
Dim
snapshot
=
sourceDocument
.
GetTextAsync
().
Result
.
FindCorrespondingEditorTextSnapshot
()
...
...
@@ -106,7 +106,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
Assert
.
Equal
(
expectedNavigationPosition
,
navigationPoint
.
Position
)
Assert
.
Equal
(
expectedVirtualSpace
,
navigationPoint
.
VirtualSpaces
)
End
Using
End
Sub
End
Function
Private
Sub
AssertEqual
(
expectedItems
As
IEnumerable
(
Of
ExpectedItem
),
actualItems
As
IEnumerable
(
Of
NavigationBarItem
),
isCaseSensitive
As
Boolean
)
Assert
.
Equal
(
expectedItems
.
Count
,
actualItems
.
Count
)
...
...
src/EditorFeatures/Test2/NavigationBar/VisualBasicNavigationBarTests.vb
浏览文件 @
15456cdb
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录