Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
2e69542e
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,发现更多精彩内容 >>
未验证
提交
2e69542e
编写于
5月 09, 2018
作者:
J
Jinu
提交者:
GitHub
5月 09, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #26718 from sharwell/fix-resource
Fix the message for Make Field Readonly
上级
dfe02b6a
15f74696
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
76 addition
and
4 deletion
+76
-4
src/EditorFeatures/TestUtilities/Diagnostics/AbstractDiagnosticProviderBasedUserDiagnosticTest.cs
...tics/AbstractDiagnosticProviderBasedUserDiagnosticTest.cs
+69
-0
src/EditorFeatures/VisualBasicTest/Diagnostics/AddImport/AddImportTests_NuGet.vb
...alBasicTest/Diagnostics/AddImport/AddImportTests_NuGet.vb
+3
-1
src/Features/Core/Portable/MakeFieldReadonly/AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs
...ldReadonly/AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs
+1
-1
src/Test/Utilities/Portable/Diagnostics/DescriptorFactory.cs
src/Test/Utilities/Portable/Diagnostics/DescriptorFactory.cs
+3
-2
未找到文件。
src/EditorFeatures/TestUtilities/Diagnostics/AbstractDiagnosticProviderBasedUserDiagnosticTest.cs
浏览文件 @
2e69542e
...
...
@@ -36,6 +36,75 @@ internal virtual (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderA
:
CreateDiagnosticProviderAndFixer
(
workspace
,
parameters
);
}
[
Fact
]
public
void
TestSupportedDiagnosticsMessageTitle
()
{
using
(
var
workspace
=
new
AdhocWorkspace
())
{
var
diagnosticAnalyzer
=
CreateDiagnosticProviderAndFixer
(
workspace
).
Item1
;
if
(
diagnosticAnalyzer
==
null
)
{
return
;
}
foreach
(
var
descriptor
in
diagnosticAnalyzer
.
SupportedDiagnostics
)
{
if
(
descriptor
.
CustomTags
.
Contains
(
WellKnownDiagnosticTags
.
NotConfigurable
))
{
// The title only displayed for rule configuration
continue
;
}
Assert
.
NotEqual
(
""
,
descriptor
.
Title
?.
ToString
()
??
""
);
}
}
}
[
Fact
]
public
void
TestSupportedDiagnosticsMessageDescription
()
{
using
(
var
workspace
=
new
AdhocWorkspace
())
{
var
diagnosticAnalyzer
=
CreateDiagnosticProviderAndFixer
(
workspace
).
Item1
;
if
(
diagnosticAnalyzer
==
null
)
{
return
;
}
foreach
(
var
descriptor
in
diagnosticAnalyzer
.
SupportedDiagnostics
)
{
if
(
descriptor
.
CustomTags
.
Contains
(
WellKnownDiagnosticTags
.
NotConfigurable
))
{
if
(!
descriptor
.
IsEnabledByDefault
||
descriptor
.
DefaultSeverity
==
DiagnosticSeverity
.
Hidden
)
{
// The message only displayed if either enabled and not hidden, or configurable
continue
;
}
}
Assert
.
NotEqual
(
""
,
descriptor
.
MessageFormat
?.
ToString
()
??
""
);
}
}
}
[
Fact
(
Skip
=
"https://github.com/dotnet/roslyn/issues/26717"
)]
public
void
TestSupportedDiagnosticsMessageHelpLinkUri
()
{
using
(
var
workspace
=
new
AdhocWorkspace
())
{
var
diagnosticAnalyzer
=
CreateDiagnosticProviderAndFixer
(
workspace
).
Item1
;
if
(
diagnosticAnalyzer
==
null
)
{
return
;
}
foreach
(
var
descriptor
in
diagnosticAnalyzer
.
SupportedDiagnostics
)
{
Assert
.
NotEqual
(
""
,
descriptor
.
HelpLinkUri
??
""
);
}
}
}
internal
async
override
Task
<
IEnumerable
<
Diagnostic
>>
GetDiagnosticsAsync
(
TestWorkspace
workspace
,
TestParameters
parameters
)
{
...
...
src/EditorFeatures/VisualBasicTest/Diagnostics/AddImport/AddImportTests_NuGet.vb
浏览文件 @
2e69542e
...
...
@@ -30,7 +30,9 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeActions.AddImp
End
Function
Friend
Overrides
Function
CreateDiagnosticProviderAndFixer
(
workspace
As
Workspace
)
As
(
DiagnosticAnalyzer
,
CodeFixProvider
)
Throw
New
NotImplementedException
()
' This is used by inherited tests to ensure the properties of diagnostic analyzers are correct. It's not
' needed by the tests in this class, but can't throw an exception.
Return
(
Nothing
,
Nothing
)
End
Function
Friend
Overrides
Function
CreateDiagnosticProviderAndFixer
(
workspace
As
Workspace
,
parameters
As
TestParameters
)
As
(
DiagnosticAnalyzer
,
CodeFixProvider
)
...
...
src/Features/Core/Portable/MakeFieldReadonly/AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs
浏览文件 @
2e69542e
...
...
@@ -17,7 +17,7 @@ protected AbstractMakeFieldReadonlyDiagnosticAnalyzer()
:
base
(
IDEDiagnosticIds
.
MakeFieldReadonlyDiagnosticId
,
new
LocalizableResourceString
(
nameof
(
FeaturesResources
.
Add_readonly_modifier
),
FeaturesResources
.
ResourceManager
,
typeof
(
FeaturesResources
)),
new
LocalizableResourceString
(
nameof
(
FeaturesResources
.
Make_field_readonly
),
WorkspacesResources
.
ResourceManager
,
typeof
(
Workspac
esResources
)))
new
LocalizableResourceString
(
nameof
(
FeaturesResources
.
Make_field_readonly
),
FeaturesResources
.
ResourceManager
,
typeof
(
Featur
esResources
)))
{
}
...
...
src/Test/Utilities/Portable/Diagnostics/DescriptorFactory.cs
浏览文件 @
2e69542e
...
...
@@ -14,7 +14,8 @@ public static class DescriptorFactory
/// </summary>
/// <remarks>
/// Returned <see cref="DiagnosticDescriptor"/> has
/// - empty <see cref="DiagnosticDescriptor.Title"/>, <see cref="DiagnosticDescriptor.MessageFormat"/> and <see cref="DiagnosticDescriptor.Category"/>
/// - empty <see cref="DiagnosticDescriptor.Title"/> and <see cref="DiagnosticDescriptor.Category"/>
/// - <see cref="DiagnosticDescriptor.MessageFormat"/> set to <paramref name="id"/>
/// - <see cref="DiagnosticDescriptor.DefaultSeverity"/> set to <see cref="DiagnosticSeverity.Hidden"/>
/// - <see cref="WellKnownDiagnosticTags.NotConfigurable"/> custom tag added in <see cref="DiagnosticDescriptor.CustomTags"/>.
/// </remarks>
...
...
@@ -22,7 +23,7 @@ public static class DescriptorFactory
/// <returns>A <see cref="DiagnosticDescriptor"/> with specified <see cref="DiagnosticDescriptor.Id"/>.</returns>
public
static
DiagnosticDescriptor
CreateSimpleDescriptor
(
string
id
)
{
return
new
DiagnosticDescriptor
(
id
,
title
:
""
,
messageFormat
:
""
,
category
:
""
,
return
new
DiagnosticDescriptor
(
id
,
title
:
""
,
messageFormat
:
id
,
category
:
""
,
defaultSeverity
:
DiagnosticSeverity
.
Hidden
,
isEnabledByDefault
:
true
,
customTags
:
WellKnownDiagnosticTags
.
NotConfigurable
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录