Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
60f8761c
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,发现更多精彩内容 >>
提交
60f8761c
编写于
11月 16, 2017
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add test to verify linked file updating works properly.
上级
37f8ac24
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
63 addition
and
8 deletion
+63
-8
src/EditorFeatures/Test2/Diagnostics/AbstractCrossLanguageUserDiagnosticTest.vb
...t2/Diagnostics/AbstractCrossLanguageUserDiagnosticTest.vb
+9
-5
src/EditorFeatures/Test2/Diagnostics/AddImport/AddImportCrossLanguageTests.vb
...est2/Diagnostics/AddImport/AddImportCrossLanguageTests.vb
+5
-3
src/EditorFeatures/Test2/Diagnostics/UseAutoProperty/UseAutoPropertyTests.vb
...Test2/Diagnostics/UseAutoProperty/UseAutoPropertyTests.vb
+49
-0
未找到文件。
src/EditorFeatures/Test2/Diagnostics/AbstractCrossLanguageUserDiagnosticTest.vb
浏览文件 @
60f8761c
...
...
@@ -44,7 +44,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics
Optional
codeActionIndex
As
Integer
=
0
,
Optional
verifyTokens
As
Boolean
=
True
,
Optional
fileNameToExpected
As
Dictionary
(
Of
String
,
String
)
=
Nothing
,
Optional
verifySolutions
As
Action
(
Of
Solution
,
Solution
)
=
Nothing
,
Optional
verifySolutions
As
Func
(
Of
Solution
,
Solution
,
Task
)
=
Nothing
,
Optional
onAfterWorkspaceCreated
As
Action
(
Of
TestWorkspace
)
=
Nothing
)
As
Task
Using
workspace
=
TestWorkspace
.
CreateWorkspace
(
definition
)
onAfterWorkspaceCreated
?
.
Invoke
(
workspace
)
...
...
@@ -65,16 +65,20 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics
Dim
updatedSolution
=
workspace
.
CurrentSolution
verifySolutions
?
.
Invoke
(
oldSolution
,
updatedSolution
)
If
verifySolutions
IsNot
Nothing
Then
Await
verifySolutions
(
oldSolution
,
updatedSolution
)
End
If
If
expected
Is
Nothing
AndAlso
fileNameToExpected
Is
Nothing
Then
If
expected
Is
Nothing
AndAlso
fileNameToExpected
Is
Nothing
AndAlso
verifySolutions
Is
Nothing
Then
Dim
projectChanges
=
SolutionUtilities
.
GetSingleChangedProjectChanges
(
oldSolution
,
updatedSolution
)
Assert
.
Empty
(
projectChanges
.
GetChangedDocuments
())
ElseIf
expected
IsNot
Nothing
Then
Dim
updatedDocument
=
SolutionUtilities
.
GetSingleChangedDocument
(
oldSolution
,
updatedSolution
)
Await
VerifyAsync
(
expected
,
verifyTokens
,
updatedDocument
)
Else
Else
If
fileNameToExpected
IsNot
Nothing
Then
For
Each
kvp
In
fileNameToExpected
Dim
updatedDocument
=
updatedSolution
.
Projects
.
SelectMany
(
Function
(
p
)
p
.
Documents
).
Single
(
Function
(
d
)
d
.
Name
=
kvp
.
Key
)
Await
VerifyAsync
(
kvp
.
Value
,
verifyTokens
,
updatedDocument
)
...
...
@@ -134,7 +138,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics
Dim
hostDocument
=
GetHostDocument
(
workspace
)
Dim
invocationBuffer
=
hostDocument
.
TextBuffer
Dim
invocationPoint
=
workspace
.
Documents
.
Single
(
Function
(
d
)
d
.
CursorPosition
.
HasValue
).
CursorPosition
.
Value
Dim
invocationPoint
=
workspace
.
Documents
.
Single
(
Function
(
d
)
d
.
CursorPosition
.
HasValue
AndAlso
Not
d
.
IsLinkFile
).
CursorPosition
.
Value
Dim
document
=
workspace
.
CurrentSolution
.
GetDocument
(
hostDocument
.
Id
)
...
...
src/EditorFeatures/Test2/Diagnostics/AddImport/AddImportCrossLanguageTests.vb
浏览文件 @
60f8761c
...
...
@@ -11,6 +11,7 @@ Imports Microsoft.CodeAnalysis.IncrementalCaches
Imports
Microsoft.CodeAnalysis.SolutionCrawler
Imports
Microsoft.CodeAnalysis.UnitTests
Imports
Microsoft.CodeAnalysis.VisualBasic.AddImport
Imports
Roslyn.Utilities
Namespace
Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics.AddImport
...
...
@@ -509,12 +510,12 @@ namespace CSAssembly2
Optional
codeActionIndex
As
Integer
=
0
,
Optional
addedReference
As
String
=
Nothing
,
Optional
onAfterWorkspaceCreated
As
Action
(
Of
TestWorkspace
)
=
Nothing
)
As
Task
Dim
verifySolutions
As
Action
(
Of
Solution
,
Solution
)
=
Nothing
Dim
verifySolutions
As
Func
(
Of
Solution
,
Solution
,
Task
)
=
Nothing
Dim
workspace
As
TestWorkspace
=
Nothing
If
addedReference
IsNot
Nothing
Then
verifySolutions
=
Sub
(
oldSolution
As
Solution
,
newSolution
As
Solution
)
Function
(
oldSolution
As
Solution
,
newSolution
As
Solution
)
Dim
initialDocId
=
workspace
.
DocumentWithCursor
.
Id
Dim
oldProject
=
oldSolution
.
GetDocument
(
initialDocId
).
Project
Dim
newProject
=
newSolution
.
GetDocument
(
initialDocId
).
Project
...
...
@@ -529,7 +530,8 @@ namespace CSAssembly2
Select
p
.
Name
Assert
.
True
(
newProjectReferences
.
Contains
(
addedReference
))
End
Sub
Return
SpecializedTasks
.
EmptyTask
End
Function
End
If
Await
TestAsync
(
definition
,
expected
,
codeActionIndex
,
...
...
src/EditorFeatures/Test2/Diagnostics/UseAutoProperty/UseAutoPropertyTests.vb
浏览文件 @
60f8761c
...
...
@@ -94,5 +94,54 @@ end class
</
text
>
.
Value
.
Trim
()}
})
End
Function
<
Fact
(),
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsUseAutoProperty
)
>
Public
Async
Function
TestLinkedFile
()
As
System
.
Threading
.
Tasks
.
Task
Dim
input
=
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
AssemblyName
=
"LinkedProj"
Name
=
"CSProj.1"
>
<
Document
FilePath
=
'C.cs'>
partial
class
C
{
$$
int
i
;
public
int
P
{
get
{
return
i
;
}
}
public
C
()
{
this
.
i
=
0
;
}
}
</
Document
>
</
Project
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
AssemblyName
=
"LinkedProj"
Name
=
"CSProj.2"
>
<
Document
IsLinkFile
=
"true"
LinkProjectName
=
"CSProj.1"
LinkFilePath
=
"C.cs"
/>
</
Project
>
</
Workspace
>
Dim
expectedText
=
"
partial class C
{
public int P { get; private set; }
public C()
{
this.P = 0;
}
}"
.
Trim
()
Await
TestAsync
(
input
,
verifySolutions
:
=
Async
Function
(
oldSolution
,
newSolution
)
Dim
documents
=
newSolution
.
Projects
.
SelectMany
(
Function
(
p
)
p
.
Documents
).
Where
(
Function
(
d
)
d
.
Name
=
"C.cs"
)
Assert
.
Equal
(
2
,
documents
.
Count
())
For
Each
doc
In
documents
Dim
text
=
(
Await
doc
.
GetTextAsync
()).
ToString
().
Trim
()
Assert
.
Equal
(
expectedText
,
text
)
Next
End
Function
)
End
Function
End
Class
End
Namespace
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录