Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
e5d1c566
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,发现更多精彩内容 >>
提交
e5d1c566
编写于
3月 29, 2020
作者:
S
Sam Harwell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Convert AddAccessibilityModifiersTests to the new test framework
上级
c5a98d83
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
106 addition
and
111 deletion
+106
-111
src/Analyzers/VisualBasic/CodeFixes/AddAccessibilityModifiers/VisualBasicAddAccessibilityModifiersCodeFixProvider.vb
...rs/VisualBasicAddAccessibilityModifiersCodeFixProvider.vb
+2
-2
src/Analyzers/VisualBasic/Tests/AddAccessibilityModifiers/AddAccessibilityModifiersTests.vb
...dAccessibilityModifiers/AddAccessibilityModifiersTests.vb
+104
-109
未找到文件。
src/Analyzers/VisualBasic/CodeFixes/AddAccessibilityModifiers/VisualBasicAddAccessibilityModifiersCodeFixProvider.vb
浏览文件 @
e5d1c566
...
...
@@ -3,9 +3,9 @@
' See the LICENSE file in the project root for more information.
Imports
System.Composition
Imports
System.Diagnostics.CodeAnalysis
Imports
Microsoft.CodeAnalysis.AddAccessibilityModifiers
Imports
Microsoft.CodeAnalysis.CodeFixes
Imports
Microsoft.CodeAnalysis.Host.Mef
Imports
Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace
Microsoft.CodeAnalysis.VisualBasic.AddAccessibilityModifiers
...
...
@@ -14,7 +14,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.AddAccessibilityModifiers
Inherits
AbstractAddAccessibilityModifiersCodeFixProvider
<
ImportingConstructor
>
<
SuppressMessage
(
"RoslynDiagnosticsReliability"
,
"RS0033:Importing constructor should be [Obsolete]"
,
Justification
:
=
"Used in test code: https://github.com/dotnet/roslyn/issues/42814"
)
>
<
Obsolete
(
MefConstruction
.
ImportingConstructorMessage
,
True
)
>
Public
Sub
New
()
End
Sub
...
...
src/Analyzers/VisualBasic/Tests/AddAccessibilityModifiers/AddAccessibilityModifiersTests.vb
浏览文件 @
e5d1c566
...
...
@@ -2,121 +2,110 @@
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports
Microsoft.CodeAnalysis.CodeFixes
Imports
Microsoft.CodeAnalysis.CodeStyle
Imports
Microsoft.CodeAnalysis.Diagnostics
Imports
Microsoft.CodeAnalysis.VisualBasic.AddAccessibilityModifiers
Imports
Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions
Imports
Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics
Imports
VerifyVB
=
Microsoft
.
CodeAnalysis
.
Editor
.
UnitTests
.
CodeActions
.
VisualBasicCodeFixVerifier
(
Of
Microsoft
.
CodeAnalysis
.
VisualBasic
.
AddAccessibilityModifiers
.
VisualBasicAddAccessibilityModifiersDiagnosticAnalyzer
,
Microsoft
.
CodeAnalysis
.
VisualBasic
.
AddAccessibilityModifiers
.
VisualBasicAddAccessibilityModifiersCodeFixProvider
)
Namespace
Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.AddAccessibilityModifiers
Public
Class
AddAccessibilityModifiersTests
Inherits
AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest
Friend
Overrides
Function
CreateDiagnosticProviderAndFixer
(
workspace
As
Workspace
)
As
(
DiagnosticAnalyzer
,
CodeFixProvider
)
Return
(
New
VisualBasicAddAccessibilityModifiersDiagnosticAnalyzer
(),
New
VisualBasicAddAccessibilityModifiersCodeFixProvider
())
End
Function
Private
ReadOnly
Property
OmitDefaultModifiers
As
IOptionsCollection
Get
Return
OptionsSet
(
SingleOption
(
CodeStyleOptions2
.
RequireAccessibilityModifiers
,
AccessibilityModifiersRequired
.
OmitIfDefault
,
NotificationOption2
.
Suggestion
))
End
Get
End
Property
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsAddAccessibilityModifiers
)
>
Public
Sub
TestStandardProperties
()
VerifyVB
.
VerifyStandardProperties
()
End
Sub
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsAddAccessibilityModifiers
)
>
Public
Async
Function
TestAllConstructs
()
As
Task
Await
TestInRegularAndScript
Async
(
Await
VerifyVB
.
VerifyCodeFix
Async
(
"
namespace N
namespace Outer.Inner
class
{|FixAllInDocument:C|}
class
NestedClass
class
[|C|]
class
[|NestedClass|]
end class
structure
NestedStruct
structure
[|NestedStruct|]
end structure
dim
f1
as integer
dim
f2
, f3 as integer
dim
f4
, f5 as integer, f6, f7 as boolean
public
f4
as integer
dim
[|f1|]
as integer
dim
[|f2|]
, f3 as integer
dim
[|f4|]
, f5 as integer, f6, f7 as boolean
public
{|BC30260:f4|}
as integer
event
e1 as Action
public event e2 as
Action
event
[|e1|] as {|BC31044:{|BC30002:Action|}|}
public event e2 as
{|BC31044:{|BC30002:Action|}|}
custom event
e4 as Action
custom event
{|BC31130:{|BC31131:{|BC31132:[|e4|]|}|}|} as {|BC31044:{|BC30002:Action|}|}
end event
shared sub new()
end sub
sub
new
()
sub
[|new|]
()
end sub
public sub new(i as integer)
end sub
sub
M1
()
sub
[|M1|]
()
end sub
public sub M2()
end sub
function
M3
() as integer
function
[|M3|]
() as integer
end function
function M4() as integer
{|BC30027:function [|M4|]() as integer|}
public function M5() as integer
{|BC30289:public function M5() as integer|}
end function
partial sub M6
()
{|BC31432:partial|} sub [|M6|]
()
end sub
property
P1
as integer
property
[|P1|]
as integer
property
P2
as integer
property
{|BC30124:[|P2|]|}
as integer
get
end get
end property
public property P3 as integer
shared operator
&
(c1 as C, c2 as C) as integer
shared operator
[|&|]
(c1 as C, c2 as C) as integer
end operator
end class
interface
I
event e6 as
Action
interface
[|I|]
event e6 as
{|BC31044:{|BC30002:Action|}|}
sub M3()
function M4() as integer
property P3 as integer
end interface
delegate sub
D1
()
delegate function
D2
() as integer
delegate sub
[|D1|]
()
delegate function
[|D2|]
() as integer
enum
E
enum
[|E|]
EMember
end enum
structure
S
dim
f
as integer
structure
[|S|]
dim
[|f|]
as integer
sub
M
()
sub
[|M|]
()
end sub
shared operator
&
(c1 as S, c2 as S) as integer
shared operator
[|&|]
(c1 as S, c2 as S) as integer
end operator
end structure
module
M
dim
f
as integer
module
[|M|]
dim
[|f|]
as integer
sub
M
()
sub
[|M|]
()
end sub
end module
end namespace
...
...
@@ -134,12 +123,12 @@ namespace N
Private f1 as integer
Private f2, f3 as integer
Private f4, f5 as integer, f6, f7 as boolean
public
f4
as integer
public
{|BC30260:f4|}
as integer
Public event e1 as
Action
public event e2 as
Action
Public event e1 as
{|BC31044:{|BC30002:Action|}|}
public event e2 as
{|BC31044:{|BC30002:Action|}|}
Public custom event
e4 as Action
Public custom event
{|BC31130:{|BC31131:{|BC31132:e4|}|}|} as {|BC31044:{|BC30002:Action|}|}
end event
shared sub new()
...
...
@@ -160,17 +149,17 @@ namespace N
Public function M3() as integer
end function
Public function M4() as integer
{|BC30027:Public function M4() as integer|}
public function M5() as integer
{|BC30289:public function M5() as integer|}
end function
partial
Public
sub M6()
partial
{|BC31431:Public|}
sub M6()
end sub
Public property P1 as integer
Public property
P2
as integer
Public property
{|BC30124:P2|}
as integer
get
end get
end property
...
...
@@ -182,7 +171,7 @@ namespace N
end class
Friend interface I
event e6 as
Action
event e6 as
{|BC31044:{|BC30002:Action|}|}
sub M3()
function M4() as integer
property P3 as integer
...
...
@@ -217,112 +206,111 @@ end namespace")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsAddAccessibilityModifiers
)
>
Public
Async
Function
TestAllConstructsWithOmit
()
As
Task
Await
TestInRegularAndScriptAsync
(
"
Dim
source
=
"
namespace N
namespace Outer.Inner
Friend class
{|FixAllInDocument:C|}
Public class
NestedClass
Friend class
[|C|]
Public class
[|NestedClass|]
end class
Public structure
NestedStruct
Public structure
[|NestedStruct|]
end structure
Private
f1
as integer
Private
f2
, f3 as integer
Private
f4
, f5 as integer, f6, f7 as boolean
public
f4
as integer
Private
[|f1|]
as integer
Private
[|f2|]
, f3 as integer
Private
[|f4|]
, f5 as integer, f6, f7 as boolean
public
{|BC30260:f4|}
as integer
Private Const
foo
As long = 3
private const
bar
= 4, barbar = 5
Private Const
[|foo|]
As long = 3
private const
[|bar|]
= 4, barbar = 5
public Const pfoo As long = 3
public Const pbar = 4, pbarbar As ULong = 5
Private Shared
sfoo
= 4
private shared
sbar
as Long = 5, sbarbar = 0
Private Shared
[|sfoo|]
= 4
private shared
[|sbar|]
as Long = 5, sbarbar = 0
public Shared spfoo = 4
public Shared spbar = 4, spbarbar as Long = 4
Public event
e1 as Action
public event
e2 as Action
Public event
[|e1|] as {|BC31044:{|BC30002:Action|}|}
public event
[|e2|] as {|BC31044:{|BC30002:Action|}|}
Public custom event
e4 as Action
Public custom event
{|BC31130:{|BC31131:{|BC31132:[|e4|]|}|}|} as {|BC31044:{|BC30002:Action|}|}
end event
shared sub new()
end sub
Public sub
new
()
Public sub
[|new|]
()
end sub
public sub
new
(i as integer)
public sub
[|new|]
(i as integer)
end sub
Public sub
M1
()
Public sub
[|M1|]
()
end sub
public sub
M2
()
public sub
[|M2|]
()
end sub
Public function
M3
() as integer
Public function
[|M3|]
() as integer
end function
Public function M4() as integer
{|BC30027:Public function [|M4|]() as integer|}
public function M5() as integer
{|BC30289:public function [|M5|]() as integer|}
end function
Private partial sub M6()
end sub
Public property
P1
as integer
Public property
[|P1|]
as integer
Public property
P2
as integer
Public property
{|BC30124:[|P2|]|}
as integer
get
end get
end property
public property
P3
as integer
public property
[|P3|]
as integer
Public shared operator
&
(c1 as C, c2 as C) as integer
Public shared operator
[|&|]
(c1 as C, c2 as C) as integer
end operator
end class
Friend interface
I
event e6 as
Action
Friend interface
[|I|]
event e6 as
{|BC31044:{|BC30002:Action|}|}
sub M3()
function M4() as integer
property P3 as integer
end interface
Friend delegate sub
D1
()
Friend delegate function
D2
() as integer
Friend delegate sub
[|D1|]
()
Friend delegate function
[|D2|]
() as integer
Friend enum
E
Friend enum
[|E|]
EMember
end enum
Friend structure
S
Public
f
as integer
Friend structure
[|S|]
Public
[|f|]
as integer
Public sub
M
()
Public sub
[|M|]
()
end sub
Public shared operator
&
(c1 as S, c2 as S) as integer
Public shared operator
[|&|]
(c1 as S, c2 as S) as integer
end operator
end structure
Friend module
M
Private
f
as integer
Friend module
[|M|]
Private
[|f|]
as integer
Public sub
M
()
Public sub
[|M|]
()
end sub
end module
end namespace
end namespace"
,
"
end namespace"
Dim
fixedSource
=
"
namespace N
namespace Outer.Inner
class C
...
...
@@ -335,7 +323,7 @@ namespace N
Dim f1 as integer
Dim f2, f3 as integer
Dim f4, f5 as integer, f6, f7 as boolean
public
f4
as integer
public
{|BC30260:f4|}
as integer
Const foo As long = 3
const bar = 4, barbar = 5
...
...
@@ -349,10 +337,10 @@ namespace N
public Shared spfoo = 4
public Shared spbar = 4, spbarbar as Long = 4
event e1 as
Action
event e2 as
Action
event e1 as
{|BC31044:{|BC30002:Action|}|}
event e2 as
{|BC31044:{|BC30002:Action|}|}
custom event
e4 as Action
custom event
{|BC31130:{|BC31131:{|BC31132:e4|}|}|} as {|BC31044:{|BC30002:Action|}|}
end event
shared sub new()
...
...
@@ -373,9 +361,9 @@ namespace N
function M3() as integer
end function
function M4() as integer
{|BC30027:function M4() as integer|}
function M5() as integer
{|BC30289:function M5() as integer|}
end function
Private partial sub M6()
...
...
@@ -383,7 +371,7 @@ namespace N
property P1 as integer
property
P2
as integer
property
{|BC30124:P2|}
as integer
get
end get
end property
...
...
@@ -395,7 +383,7 @@ namespace N
end class
interface I
event e6 as
Action
event e6 as
{|BC31044:{|BC30002:Action|}|}
sub M3()
function M4() as integer
property P3 as integer
...
...
@@ -425,7 +413,14 @@ namespace N
end sub
end module
end namespace
end namespace"
,
options
:
=
OmitDefaultModifiers
)
end namespace"
Dim
test
As
New
VerifyVB
.
Test
()
test
.
TestCode
=
source
test
.
FixedCode
=
fixedSource
test
.
Options
.
Add
(
CodeStyleOptions2
.
RequireAccessibilityModifiers
,
AccessibilityModifiersRequired
.
OmitIfDefault
)
Await
test
.
RunAsync
()
End
Function
End
Class
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录