Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
d58c646a
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,发现更多精彩内容 >>
提交
d58c646a
编写于
9月 10, 2015
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add multi file tests.
上级
08b3602c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
118 addition
and
11 deletion
+118
-11
src/EditorFeatures/Test2/Diagnostics/AbstractCrossLanguageUserDiagnosticTest.vb
...t2/Diagnostics/AbstractCrossLanguageUserDiagnosticTest.vb
+20
-9
src/EditorFeatures/Test2/Diagnostics/UseAutoProperty/UseAutoPropertyTests.vb
...Test2/Diagnostics/UseAutoProperty/UseAutoPropertyTests.vb
+95
-0
src/EditorFeatures/Test2/EditorServicesTest2.vbproj
src/EditorFeatures/Test2/EditorServicesTest2.vbproj
+2
-1
src/EditorFeatures/Test2/Rename/RenameEngineResult.vb
src/EditorFeatures/Test2/Rename/RenameEngineResult.vb
+1
-1
未找到文件。
src/EditorFeatures/Test2/Diagnostics/AbstractCrossLanguageUserDiagnosticTest.vb
浏览文件 @
d58c646a
...
...
@@ -19,9 +19,10 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics
Friend
MustOverride
Function
CreateDiagnosticProviderAndFixer
(
workspace
As
Workspace
,
language
As
String
)
As
Tuple
(
Of
DiagnosticAnalyzer
,
CodeFixProvider
)
Protected
Sub
Test
(
definition
As
XElement
,
expected
As
Str
ing
,
Optional
expected
As
String
=
Noth
ing
,
Optional
codeActionIndex
As
Integer
=
0
,
Optional
verifyTokens
As
Boolean
=
True
)
Optional
verifyTokens
As
Boolean
=
True
,
Optional
fileNameToExpected
As
Dictionary
(
Of
String
,
String
)
=
Nothing
)
Using
workspace
=
TestWorkspaceFactory
.
CreateWorkspace
(
definition
)
Dim
diagnosticAndFix
=
GetDiagnosticAndFix
(
workspace
)
Dim
codeAction
=
diagnosticAndFix
.
Item2
.
Fixes
.
ElementAt
(
codeActionIndex
).
Action
...
...
@@ -31,19 +32,29 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics
Dim
oldSolution
=
workspace
.
CurrentSolution
Dim
updatedSolution
=
edit
.
ChangedSolution
Dim
updatedDocument
=
SolutionUtilities
.
GetSingleChangedDocument
(
oldSolution
,
updatedSolution
)
If
fileNameToExpected
Is
Nothing
Then
Dim
updatedDocument
=
SolutionUtilities
.
GetSingleChangedDocument
(
oldSolution
,
updatedSolution
)
Dim
actual
=
updatedDocument
.
GetTextAsync
().
Result
.
ToString
().
Trim
()
If
verifyTokens
Then
Utilities
.
AssertEx
.
TokensAreEqual
(
expected
,
actual
,
updatedDocument
.
Project
.
Language
)
Verify
(
expected
,
verifyTokens
,
updatedDocument
)
Else
AssertEx
.
Equal
(
expected
,
actual
)
For
Each
kvp
In
fileNameToExpected
Dim
updatedDocument
=
updatedSolution
.
Projects
.
SelectMany
(
Function
(
p
)
p
.
Documents
).
Single
(
Function
(
d
)
d
.
Name
=
kvp
.
Key
)
Verify
(
kvp
.
Value
,
verifyTokens
,
updatedDocument
)
Next
End
If
End
Using
End
Sub
Private
Shared
Sub
Verify
(
expected
As
String
,
verifyTokens
As
Boolean
,
updatedDocument
As
Document
)
Dim
actual
=
updatedDocument
.
GetTextAsync
().
Result
.
ToString
().
Trim
()
If
verifyTokens
Then
Utilities
.
AssertEx
.
TokensAreEqual
(
expected
,
actual
,
updatedDocument
.
Project
.
Language
)
Else
AssertEx
.
Equal
(
expected
,
actual
)
End
If
End
Sub
Friend
Function
GetDiagnosticAndFix
(
workspace
As
TestWorkspace
)
As
Tuple
(
Of
Diagnostic
,
CodeFixCollection
)
Return
GetDiagnosticAndFixes
(
workspace
).
FirstOrDefault
()
End
Function
...
...
src/EditorFeatures/Test2/Diagnostics/UseAutoProperty/UseAutoPropertyTests.vb
0 → 100644
浏览文件 @
d58c646a
Imports
Microsoft.CodeAnalysis.CodeFixes
Imports
Microsoft.CodeAnalysis.Diagnostics
Namespace
Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics.UseAutoProperty
Public
Class
UseAutoPropertyTests
Inherits
AbstractCrossLanguageUserDiagnosticTest
Friend
Overrides
Function
CreateDiagnosticProviderAndFixer
(
workspace
As
Workspace
,
language
As
String
)
As
Tuple
(
Of
DiagnosticAnalyzer
,
CodeFixProvider
)
If
language
=
LanguageNames
.
CSharp
Then
Return
New
Tuple
(
Of
DiagnosticAnalyzer
,
CodeFixProvider
)(
New
CSharp
.
UseAutoProperty
.
UseAutoPropertyAnalyzer
(),
New
CSharp
.
UseAutoProperty
.
UseAutoPropertyCodeFixProvider
())
ElseIf
language
=
LanguageNames
.
VisualBasic
Return
New
Tuple
(
Of
DiagnosticAnalyzer
,
CodeFixProvider
)(
New
VisualBasic
.
UseAutoProperty
.
UseAutoPropertyAnalyzer
(),
New
VisualBasic
.
UseAutoProperty
.
UseAutoPropertyCodeFixProvider
())
Else
Throw
New
Exception
()
End
If
End
Function
<
Fact
(),
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsUseAutoProperty
)
>
Public
Sub
TestMultiFile_CSharp
()
Dim
input
=
<
Workspace
>
<
Project
Language
=
'C#' AssemblyName='CSharpAssembly1' CommonReferences='true'>
<
Document
FilePath
=
'Test1.cs'>
partial
class
C
{
int
$$
i
;
}
</
Document
>
<
Document
FilePath
=
'Test2.cs'>
partial
class
C
{
int
P
{
get
{
return
i
;
}
}
}
</
Document
>
</
Project
>
</
Workspace
>
Test
(
input
,
fileNameToExpected
:
=
New
Dictionary
(
Of
String
,
String
)
From
{
{
"Test1.cs"
,
<
text
>
partial
class
C
{
}
</
text
>
.
Value
.
Trim
()},
{
"Test2.cs"
,
<
text
>
partial
class
C
{
int
P
{
get
;
}
}
</
text
>
.
Value
.
Trim
()}
})
End
Sub
<
Fact
(),
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsUseAutoProperty
)
>
Public
Sub
TestMultiFile_VisualBasic
()
Dim
input
=
<
Workspace
>
<
Project
Language
=
'Visual Basic' AssemblyName='CSharpAssembly1' CommonReferences='true'>
<
Document
FilePath
=
'Test1.vb'>
partial
class
C
dim
$$
i
as
Integer
end
class
</
Document
>
<
Document
FilePath
=
'Test2.vb'>
partial
class
C
property
P
as
Integer
get
return
i
end
get
end
property
end
class
</
Document
>
</
Project
>
</
Workspace
>
Test
(
input
,
fileNameToExpected
:
=
New
Dictionary
(
Of
String
,
String
)
From
{
{
"Test1.vb"
,
<
text
>
partial
class
C
end
class
</
text
>
.
Value
.
Trim
()},
{
"Test2.vb"
,
<
text
>
partial
class
C
ReadOnly
property
P
as
Integer
end
class
</
text
>
.
Value
.
Trim
()}
})
End
Sub
End
Class
End
Namespace
\ No newline at end of file
src/EditorFeatures/Test2/EditorServicesTest2.vbproj
浏览文件 @
d58c646a
...
...
@@ -173,6 +173,7 @@
<ItemGroup>
<Compile
Include=
"CallHierarchy\CallHierarchyTests.vb"
/>
<Compile
Include=
"Diagnostics\InMemoryAssemblyLoader.vb"
/>
<Compile
Include=
"Diagnostics\UseAutoProperty\UseAutoPropertyTests.vb"
/>
<Compile
Include=
"LanguageServices\SyntaxFactsServiceTests.vb"
/>
<Compile
Include=
"Utilities\MockDocumentNavigationServiceProvider.vb"
/>
<Compile
Include=
"Utilities\MockSymbolNavigationServiceProvider.vb"
/>
...
...
@@ -320,4 +321,4 @@
<Import
Project=
"..\..\..\build\Targets\Roslyn.Toolsets.Xunit.targets"
/>
<Import
Project=
"$(SolutionDir)\.nuget\NuGet.targets"
Condition=
"Exists('$(SolutionDir)\.nuget\NuGet.targets')"
/>
</ImportGroup>
</Project>
</Project>
\ No newline at end of file
src/EditorFeatures/Test2/Rename/RenameEngineResult.vb
浏览文件 @
d58c646a
...
...
@@ -85,7 +85,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename
Dim
locations
=
RenameLocations
.
FindAsync
(
symbol
,
workspace
.
CurrentSolution
,
optionSet
,
CancellationToken
.
None
).
Result
Dim
originalName
=
symbol
.
Name
.
Split
(
"."
c
).
Last
()
Dim
result
=
ConflictResolver
.
ResolveConflictsAsync
(
locations
,
originalName
,
renameTo
,
optionSet
,
CancellationToken
.
None
).
Result
Dim
result
=
ConflictResolver
.
ResolveConflictsAsync
(
locations
,
originalName
,
renameTo
,
optionSet
,
hasConflict
:
=
Nothing
,
cancellationToken
:
=
CancellationToken
.
None
).
Result
engineResult
=
New
RenameEngineResult
(
workspace
,
result
,
renameTo
)
engineResult
.
AssertUnlabeledSpansRenamedAndHaveNoConflicts
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录