Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
218d1bfe
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,发现更多精彩内容 >>
提交
218d1bfe
编写于
4月 24, 2020
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Run VB tests OOP
上级
9d30c3e2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
83 addition
and
64 deletion
+83
-64
src/EditorFeatures/VisualBasicTest/CodeActions/EncapsulateField/EncapsulateFieldTests.vb
...est/CodeActions/EncapsulateField/EncapsulateFieldTests.vb
+83
-64
未找到文件。
src/EditorFeatures/VisualBasicTest/CodeActions/EncapsulateField/EncapsulateFieldTests.vb
浏览文件 @
218d1bfe
...
...
@@ -4,9 +4,16 @@
Imports
Microsoft.CodeAnalysis.CodeRefactorings
Imports
Microsoft.CodeAnalysis.CodeStyle
Imports
Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions
Imports
Microsoft.CodeAnalysis.EncapsulateField
Imports
Microsoft.CodeAnalysis.Test.Utilities.RemoteHost
Namespace
Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeRefactorings.EncapsulateField
Public
Enum
TestHost
InProcess
OutOfProcess
End
Enum
Public
Class
EncapsulateFieldTests
Inherits
AbstractVisualBasicCodeActionTest
...
...
@@ -14,8 +21,14 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeRefactorings.E
Return
New
EncapsulateFieldRefactoringProvider
()
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulatePrivateFieldAndUpdateReferences
()
As
Task
Private
Function
GetHostOptions
(
host
As
TestHost
)
As
OptionsCollection
Return
New
OptionsCollection
(
GetLanguage
())
From
{
{
RemoteHostOptions
.
RemoteHostTest
,
host
<>
TestHost
.
InProcess
}
}
End
Function
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulatePrivateFieldAndUpdateReferences
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Class
C
Private
ReadOnly
x
[||]
As
Integer
...
...
@@ -48,12 +61,11 @@ Class C
End
Sub
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestInRegularAndScriptAsync
(
text
,
expected
)
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
options
:
=
GetHostOptions
(
host
))
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateDimField
()
As
Task
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateDimField
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Class
C
Dim
x
[||]
As
Integer
...
...
@@ -81,12 +93,12 @@ Class C
End
Sub
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestInRegularAndScriptAsync
(
text
,
expected
)
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
options
:
=
GetHostOptions
(
host
)
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateGenericField
()
As
Task
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateGenericField
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Class
C
(
Of
T
)
Dim
x
[||]
As
T
...
...
@@ -114,12 +126,12 @@ Class C(Of T)
End
Sub
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestInRegularAndScriptAsync
(
text
,
expected
)
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
options
:
=
GetHostOptions
(
host
)
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulatePublicFieldIgnoringReferences
()
As
Task
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulatePublicFieldIgnoringReferences
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Class
C
Public
[|
x
|]
As
Integer
...
...
@@ -147,11 +159,11 @@ Class C
End
Sub
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
index
:
=
1
)
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
index
:
=
1
,
options
:
=
GetHostOptions
(
host
)
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulatePublicFieldUpdatingReferences
()
As
Task
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulatePublicFieldUpdatingReferences
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Class
C
Public
[|
x
|]
As
Integer
...
...
@@ -179,11 +191,11 @@ Class C
End
Sub
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestInRegularAndScriptAsync
(
text
,
expected
)
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
options
:
=
GetHostOptions
(
host
)
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateMultiplePrivateFieldsWithReferences
()
As
Task
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateMultiplePrivateFieldsWithReferences
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Class
C
Private
[|
x
,
y
|]
As
Integer
...
...
@@ -222,11 +234,11 @@ Class C
End
Sub
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestInRegularAndScriptAsync
(
text
,
expected
)
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
options
:
=
GetHostOptions
(
host
)
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateMultiplePublicFieldsWithReferences
()
As
Task
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateMultiplePublicFieldsWithReferences
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Class
C
[|
Public
x
As
String
...
...
@@ -267,11 +279,11 @@ Class C
End
Sub
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
index
:
=
1
)
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
index
:
=
1
,
options
:
=
GetHostOptions
(
host
)
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestNoSetterForConstField
()
As
Task
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestNoSetterForConstField
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Class
Program
Private
Const
[|
goo
|]
As
Integer
=
3
...
...
@@ -288,12 +300,12 @@ Class Program
End
Property
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestInRegularAndScriptAsync
(
text
,
expected
)
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
options
:
=
GetHostOptions
(
host
)
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateEscapedIdentifier
()
As
Task
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateEscapedIdentifier
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Class
C
Private
[|[
Class
]|]
As
String
...
...
@@ -313,12 +325,12 @@ Class C
End
Property
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestInRegularAndScriptAsync
(
text
,
expected
)
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
options
:
=
GetHostOptions
(
host
)
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateEscapedIdentifierWithQualifiedAccess
()
As
Task
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateEscapedIdentifierWithQualifiedAccess
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Class
C
Private
[|[
Class
]|]
As
String
...
...
@@ -338,12 +350,16 @@ Class C
End
Property
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
options
:
=
[
Option
]
(
CodeStyleOptions2
.
QualifyFieldAccess
,
True
,
NotificationOption2
.
Error
))
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
options
:
=
New
OptionsCollection
(
GetLanguage
())
From
{
{
CodeStyleOptions2
.
QualifyFieldAccess
,
True
,
NotificationOption2
.
Error
},
{
RemoteHostOptions
.
RemoteHostTest
,
host
<>
TestHost
.
InProcess
}
})
End
Function
<
Wpf
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateFieldNamedValue
()
As
Task
<
Wpf
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateFieldNamedValue
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Class
C
Private
[|
value
|]
As
Integer
=
3
...
...
@@ -363,12 +379,12 @@ Class C
End
Property
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestInRegularAndScriptAsync
(
text
,
expected
)
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
options
:
=
GetHostOptions
(
host
)
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateFieldName__
()
As
Task
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateFieldName__
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Class
D
Public
[|
__
|]
As
Integer
...
...
@@ -390,12 +406,12 @@ Class D
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestInRegularAndScriptAsync
(
text
,
expected
)
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
options
:
=
GetHostOptions
(
host
)
)
End
Function
<
WorkItem
(
694262
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/694262"
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestPreserveTrivia
()
As
Task
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestPreserveTrivia
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Class
AA
Private
name
As
String
:
Public
[|
dsds
|]
As
Integer
...
...
@@ -417,12 +433,12 @@ Class AA
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestInRegularAndScriptAsync
(
text
,
expected
)
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
options
:
=
GetHostOptions
(
host
)
)
End
Function
<
WorkItem
(
694241
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/694241"
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestNewPropertyNameIsUnique
()
As
Task
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestNewPropertyNameIsUnique
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Class
AA
Private
[|
name
|]
As
String
...
...
@@ -460,23 +476,23 @@ Class AA
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestInRegularAndScriptAsync
(
text
,
expected
)
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
options
:
=
GetHostOptions
(
host
)
)
End
Function
<
WorkItem
(
695046
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/695046"
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestAvailableNotJustOnVariableName
()
As
Task
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestAvailableNotJustOnVariableName
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Class
C
Private
[||]
ReadOnly
x
As
Integer
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestActionCountAsync
(
text
,
2
)
Await
TestActionCountAsync
(
text
,
2
,
New
TestParameters
(
options
:
=
GetHostOptions
(
host
))
)
End
Function
<
WorkItem
(
705898
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/705898"
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestCopyAccessibility
()
As
Task
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestCopyAccessibility
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Class
C
Protected
[|
x
|]
As
Integer
...
...
@@ -496,12 +512,12 @@ Class C
End
Property
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestInRegularAndScriptAsync
(
text
,
expected
)
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
options
:
=
GetHostOptions
(
host
)
)
End
Function
<
WorkItem
(
707080
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/707080"
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestBackingFieldStartsWithUnderscore
()
As
Task
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestBackingFieldStartsWithUnderscore
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Public
Class
Class1
Public
[|
Name
|]
As
String
...
...
@@ -530,11 +546,11 @@ Public Class Class1
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestInRegularAndScriptAsync
(
text
,
expected
)
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
options
:
=
GetHostOptions
(
host
)
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateShadowingField
()
As
Task
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestEncapsulateShadowingField
(
host
As
TestHost
)
As
Task
Dim
text
=
<
File
>
Class
C
Protected
_goo
As
Integer
...
...
@@ -584,16 +600,16 @@ Class D
End
Property
End
Class
</
File
>
.
ConvertTestSourceTag
()
Await
TestInRegularAndScriptAsync
(
text
,
expected
)
Await
TestInRegularAndScriptAsync
(
text
,
expected
,
options
:
=
GetHostOptions
(
host
)
)
End
Function
<
WorkItem
(
1096007
,
"https://github.com/dotnet/roslyn/issues/282"
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestDoNotEncapsulateOutsideTypeDeclaration
()
As
Task
<
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
TestDoNotEncapsulateOutsideTypeDeclaration
(
host
As
TestHost
)
As
Task
Dim
globalField
=
<
File
>
Dim
[|
x
|]
=
1
</
File
>
.
ConvertTestSourceTag
()
Await
TestMissingInRegularAndScriptAsync
(
globalField
)
Await
TestMissingInRegularAndScriptAsync
(
globalField
,
New
TestParameters
(
options
:
=
GetHostOptions
(
host
))
)
Dim
namespaceField
=
<
File
>
...
...
@@ -601,20 +617,20 @@ Namespace N
Dim
[|
x
|]
=
1
End
Namespace
</
File
>
.
ConvertTestSourceTag
()
Await
TestMissingInRegularAndScriptAsync
(
namespaceField
)
Await
TestMissingInRegularAndScriptAsync
(
namespaceField
,
New
TestParameters
(
options
:
=
GetHostOptions
(
host
))
)
Dim
enumField
=
<
File
>
Enum
E
[|
x
|]
=
1
End
Enum
</
File
>
.
ConvertTestSourceTag
()
Await
TestMissingInRegularAndScriptAsync
(
enumField
)
Await
TestMissingInRegularAndScriptAsync
(
enumField
,
New
TestParameters
(
options
:
=
GetHostOptions
(
host
))
)
End
Function
<
WorkItem
(
7090
,
"https://github.com/dotnet/roslyn/issues/7090"
)
>
<
Wpf
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
ApplyCurrentMePrefixStyle
()
As
Task
<
Wpf
Theory
,
CombinatorialData
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)
>
Public
Async
Function
ApplyCurrentMePrefixStyle
(
host
As
TestHost
)
As
Task
Await
TestInRegularAndScriptAsync
(
"
Class C
Dim [|i|] As Integer
...
...
@@ -633,7 +649,10 @@ Class C
End Property
End Class
"
,
options
:
=
[
Option
]
(
CodeStyleOptions2
.
QualifyFieldAccess
,
True
,
NotificationOption2
.
Error
))
options
:
=
New
OptionsCollection
(
GetLanguage
())
From
{
{
CodeStyleOptions2
.
QualifyFieldAccess
,
True
,
NotificationOption2
.
Error
},
{
RemoteHostOptions
.
RemoteHostTest
,
host
<>
TestHost
.
InProcess
}
})
End
Function
End
Class
End
Namespace
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录