Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
2174eee6
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,发现更多精彩内容 >>
提交
2174eee6
编写于
1月 03, 2020
作者:
I
Ivan Basov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix test infrastructure
上级
d6f6eaa4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
27 addition
and
23 deletion
+27
-23
src/EditorFeatures/CSharpTest/ChangeSignature/ChangeSignatureTests.cs
...atures/CSharpTest/ChangeSignature/ChangeSignatureTests.cs
+2
-1
src/EditorFeatures/CSharpTest/ChangeSignature/ReorderParametersTests.InvocationErrors.cs
...hangeSignature/ReorderParametersTests.InvocationErrors.cs
+2
-2
src/EditorFeatures/TestUtilities/ChangeSignature/AbstractChangeSignatureTests.cs
...Utilities/ChangeSignature/AbstractChangeSignatureTests.cs
+13
-12
src/EditorFeatures/TestUtilities/ChangeSignature/TestChangeSignatureOptionsService.cs
...ties/ChangeSignature/TestChangeSignatureOptionsService.cs
+1
-1
src/Features/CSharp/Portable/ChangeSignature/CSharpChangeSignatureService.cs
.../Portable/ChangeSignature/CSharpChangeSignatureService.cs
+9
-7
未找到文件。
src/EditorFeatures/CSharpTest/ChangeSignature/ChangeSignatureTests.cs
浏览文件 @
2174eee6
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
using
System.Xml.Linq
;
using
System.Xml.Linq
;
using
Microsoft.CodeAnalysis.Editor.UnitTests.ChangeSignature
;
using
Microsoft.CodeAnalysis.Editor.UnitTests.ChangeSignature
;
using
Microsoft.CodeAnalysis.Test.Utilities
;
using
Microsoft.CodeAnalysis.Test.Utilities
;
using
Microsoft.CodeAnalysis.Test.Utilities.ChangeSignature
;
using
Roslyn.Test.Utilities
;
using
Roslyn.Test.Utilities
;
using
Xunit
;
using
Xunit
;
...
@@ -315,7 +316,7 @@ public class C3
...
@@ -315,7 +316,7 @@ public class C3
using
(
var
testState
=
ChangeSignatureTestState
.
Create
(
XElement
.
Parse
(
workspaceXml
)))
using
(
var
testState
=
ChangeSignatureTestState
.
Create
(
XElement
.
Parse
(
workspaceXml
)))
{
{
testState
.
TestChangeSignatureOptionsService
.
IsCancelled
=
false
;
testState
.
TestChangeSignatureOptionsService
.
IsCancelled
=
false
;
testState
.
TestChangeSignatureOptionsService
.
UpdatedSignature
=
updatedSignature
;
testState
.
TestChangeSignatureOptionsService
.
UpdatedSignature
=
updatedSignature
.
Select
(
i
=>
new
AddedParameterOrExistingIndex
(
i
)).
ToArray
()
;
var
result
=
testState
.
ChangeSignature
();
var
result
=
testState
.
ChangeSignature
();
Assert
.
True
(
result
.
Succeeded
);
Assert
.
True
(
result
.
Succeeded
);
...
...
src/EditorFeatures/CSharpTest/ChangeSignature/ReorderParametersTests.InvocationErrors.cs
浏览文件 @
2174eee6
...
@@ -43,10 +43,10 @@ public void Goo(int x, string y)
...
@@ -43,10 +43,10 @@ public void Goo(int x, string y)
}
}
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ChangeSignature
)]
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ChangeSignature
)]
public
async
Task
ReorderMethodParameters_
InsufficientParameters_None
()
public
async
Task
ReorderMethodParameters_
CanBeStartedEvenWithNoParameters
()
{
{
var
markup
=
@"class C { void $$M() { } }"
;
var
markup
=
@"class C { void $$M() { } }"
;
await
TestChangeSignatureViaCommandAsync
(
LanguageNames
.
CSharp
,
markup
,
expectedSuccess
:
false
,
expectedErrorText
:
FeaturesResources
.
This_signature_does_not_contain_parameters_that_can_be_changed
);
await
TestChangeSignatureViaCommandAsync
(
LanguageNames
.
CSharp
,
markup
,
expectedSuccess
:
true
);
}
}
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ChangeSignature
)]
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ChangeSignature
)]
...
...
src/EditorFeatures/TestUtilities/ChangeSignature/AbstractChangeSignatureTests.cs
浏览文件 @
2174eee6
...
@@ -15,28 +15,29 @@
...
@@ -15,28 +15,29 @@
namespace
Microsoft.CodeAnalysis.Editor.UnitTests.ChangeSignature
namespace
Microsoft.CodeAnalysis.Editor.UnitTests.ChangeSignature
{
{
internal
abstract
class
AbstractChangeSignatureTests
:
AbstractCodeActionTest
public
abstract
class
AbstractChangeSignatureTests
:
AbstractCodeActionTest
{
{
protected
override
ParseOptions
GetScriptOptions
()
protected
override
ParseOptions
GetScriptOptions
()
{
{
throw
new
NotSupportedException
();
throw
new
NotSupportedException
();
}
}
public
async
Task
TestChangeSignatureViaCodeActionAsync
(
internal
async
Task
TestChangeSignatureViaCodeActionAsync
(
string
markup
,
string
markup
,
bool
expectedCodeAction
=
true
,
bool
expectedCodeAction
=
true
,
bool
isCancelled
=
false
,
bool
isCancelled
=
false
,
int
[]
updatedSignature
=
null
,
int
[]
updatedSignature
=
null
,
string
expectedCode
=
null
,
string
expectedCode
=
null
,
int
index
=
0
)
int
index
=
0
)
=>
await
TestChangeSignatureViaCodeActionAsync
(
markup
,
expectedCodeAction
,
isCancelled
,
=>
await
TestChangeSignatureViaCodeActionAsync
(
updatedSignature
.
Select
(
i
=>
new
AddedParameterOrExistingIndex
(
i
)).
ToArray
(),
expectedCode
,
index
).
ConfigureAwait
(
false
);
markup
,
updatedSignature
?.
Select
(
i
=>
new
AddedParameterOrExistingIndex
(
i
)).
ToArray
(),
expectedCodeAction
,
isCancelled
,
expectedCode
,
index
).
ConfigureAwait
(
false
);
public
async
Task
TestChangeSignatureViaCodeActionAsync
(
internal
async
Task
TestChangeSignatureViaCodeActionAsync
(
string
markup
,
string
markup
,
AddedParameterOrExistingIndex
[]
updatedSignature
,
bool
expectedCodeAction
=
true
,
bool
expectedCodeAction
=
true
,
bool
isCancelled
=
false
,
bool
isCancelled
=
false
,
AddedParameterOrExistingIndex
[]
updatedSignature
=
null
,
string
expectedCode
=
null
,
string
expectedCode
=
null
,
int
index
=
0
)
int
index
=
0
)
{
{
...
@@ -64,7 +65,7 @@ protected override ParseOptions GetScriptOptions()
...
@@ -64,7 +65,7 @@ protected override ParseOptions GetScriptOptions()
}
}
}
}
public
async
Task
TestChangeSignatureViaCommandAsync
(
internal
async
Task
TestChangeSignatureViaCommandAsync
(
string
languageName
,
string
languageName
,
string
markup
,
string
markup
,
bool
expectedSuccess
=
true
,
bool
expectedSuccess
=
true
,
...
@@ -75,20 +76,20 @@ protected override ParseOptions GetScriptOptions()
...
@@ -75,20 +76,20 @@ protected override ParseOptions GetScriptOptions()
bool
verifyNoDiagnostics
=
false
,
bool
verifyNoDiagnostics
=
false
,
ParseOptions
parseOptions
=
null
,
ParseOptions
parseOptions
=
null
,
int
expectedSelectedIndex
=
-
1
)
int
expectedSelectedIndex
=
-
1
)
=>
await
TestChangeSignatureViaCommandAsync
(
languageName
,
markup
,
expectedSuccess
,
=>
await
TestChangeSignatureViaCommandAsync
(
languageName
,
markup
,
updatedSignature
.
Select
(
i
=>
new
AddedParameterOrExistingIndex
(
i
)).
ToArray
(),
updatedSignature
?
.
Select
(
i
=>
new
AddedParameterOrExistingIndex
(
i
)).
ToArray
(),
expectedUpdatedInvocationDocumentCode
,
expected
Success
,
expected
UpdatedInvocationDocumentCode
,
expectedErrorText
,
expectedErrorText
,
totalParameters
,
totalParameters
,
verifyNoDiagnostics
,
verifyNoDiagnostics
,
parseOptions
,
parseOptions
,
expectedSelectedIndex
);
expectedSelectedIndex
);
public
async
Task
TestChangeSignatureViaCommandAsync
(
internal
async
Task
TestChangeSignatureViaCommandAsync
(
string
languageName
,
string
languageName
,
string
markup
,
string
markup
,
AddedParameterOrExistingIndex
[]
updatedSignature
,
bool
expectedSuccess
=
true
,
bool
expectedSuccess
=
true
,
AddedParameterOrExistingIndex
[]
updatedSignature
=
null
,
string
expectedUpdatedInvocationDocumentCode
=
null
,
string
expectedUpdatedInvocationDocumentCode
=
null
,
string
expectedErrorText
=
null
,
string
expectedErrorText
=
null
,
int
?
totalParameters
=
null
,
int
?
totalParameters
=
null
,
...
...
src/EditorFeatures/TestUtilities/ChangeSignature/TestChangeSignatureOptionsService.cs
浏览文件 @
2174eee6
...
@@ -29,7 +29,7 @@ AddedParameterResult IChangeSignatureOptionsService.GetAddedParameter(Document d
...
@@ -29,7 +29,7 @@ AddedParameterResult IChangeSignatureOptionsService.GetAddedParameter(Document d
Document
document
)
Document
document
)
{
{
var
list
=
parameters
.
ToListOfParameters
();
var
list
=
parameters
.
ToListOfParameters
();
var
updateParameters
=
UpdatedSignature
.
Select
(
item
=>
item
.
IsExisting
var
updateParameters
=
UpdatedSignature
?
.
Select
(
item
=>
item
.
IsExisting
?
list
[
item
.
OldIndex
]
?
list
[
item
.
OldIndex
]
:
item
.
AddedParameter
).
ToList
();
:
item
.
AddedParameter
).
ToList
();
...
...
src/Features/CSharp/Portable/ChangeSignature/CSharpChangeSignatureService.cs
浏览文件 @
2174eee6
...
@@ -390,11 +390,10 @@ private SyntaxNode GetNodeContainingTargetNode(SyntaxNode matchingNode)
...
@@ -390,11 +390,10 @@ private SyntaxNode GetNodeContainingTargetNode(SyntaxNode matchingNode)
isReducedExtensionMethod
=
true
;
isReducedExtensionMethod
=
true
;
}
}
SignatureChange
signaturePermutationWithoutAddedParameters
=
signaturePermutation
.
WithoutAddedParameters
();
SignatureChange
signaturePermutationWithoutAddedParameters
=
signaturePermutation
.
WithoutAddedParameters
();
var
newArguments
=
PermuteArgumentList
(
document
,
declarationSymbol
,
invocation
.
ArgumentList
.
Arguments
,
signaturePermutationWithoutAddedParameters
,
isReducedExtensionMethod
);
var
newArguments
=
PermuteArgumentList
(
document
,
declarationSymbol
,
invocation
.
ArgumentList
.
Arguments
,
signaturePermutationWithoutAddedParameters
,
isReducedExtensionMethod
);
newArguments
=
AddNewArgumentsToList
(
document
,
declarationSymbol
,
newArguments
,
signaturePermutation
,
isReducedExtensionMethod
);
newArguments
=
AddNewArgumentsToList
(
newArguments
,
signaturePermutation
);
return
invocation
.
WithArgumentList
(
invocation
.
ArgumentList
.
WithArguments
(
newArguments
).
WithAdditionalAnnotations
(
changeSignatureFormattingAnnotation
));
return
invocation
.
WithArgumentList
(
invocation
.
ArgumentList
.
WithArguments
(
newArguments
).
WithAdditionalAnnotations
(
changeSignatureFormattingAnnotation
));
}
}
...
@@ -449,7 +448,7 @@ private SyntaxNode GetNodeContainingTargetNode(SyntaxNode matchingNode)
...
@@ -449,7 +448,7 @@ private SyntaxNode GetNodeContainingTargetNode(SyntaxNode matchingNode)
return
null
;
return
null
;
}
}
private
SeparatedSyntaxList
<
ArgumentSyntax
>
AddNewArgumentsToList
(
Document
document
,
ISymbol
declarationSymbol
,
SeparatedSyntaxList
<
ArgumentSyntax
>
newArguments
,
SignatureChange
signaturePermutation
,
bool
isReducedExtensionMethod
)
private
SeparatedSyntaxList
<
ArgumentSyntax
>
AddNewArgumentsToList
(
SeparatedSyntaxList
<
ArgumentSyntax
>
newArguments
,
SignatureChange
signaturePermutation
)
{
{
List
<
ArgumentSyntax
>
fullList
=
new
List
<
ArgumentSyntax
>();
List
<
ArgumentSyntax
>
fullList
=
new
List
<
ArgumentSyntax
>();
...
@@ -473,12 +472,15 @@ private SeparatedSyntaxList<ArgumentSyntax> AddNewArgumentsToList(Document docum
...
@@ -473,12 +472,15 @@ private SeparatedSyntaxList<ArgumentSyntax> AddNewArgumentsToList(Document docum
}
}
else
else
{
{
if
(
newArguments
[
indexInExistingList
].
NameColon
!=
defaul
t
)
if
(
indexInExistingList
<
newArguments
.
Coun
t
)
{
{
seenNameEquals
=
true
;
if
(
newArguments
[
indexInExistingList
].
NameColon
!=
default
)
}
{
seenNameEquals
=
true
;
}
fullList
.
Add
(
newArguments
[
indexInExistingList
++]);
fullList
.
Add
(
newArguments
[
indexInExistingList
++]);
}
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录