Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
b9396297
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,发现更多精彩内容 >>
提交
b9396297
编写于
2月 27, 2017
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplify test harness.
上级
1ec0b0eb
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
144 addition
and
285 deletion
+144
-285
src/EditorFeatures/CSharpTest/CodeActions/EncapsulateField/EncapsulateFieldTests.cs
...est/CodeActions/EncapsulateField/EncapsulateFieldTests.cs
+6
-6
src/EditorFeatures/CSharpTest/CodeActions/GenerateDefaultConstructors/GenerateDefaultConstructorsTests.cs
...teDefaultConstructors/GenerateDefaultConstructorsTests.cs
+4
-10
src/EditorFeatures/CSharpTest/CodeActions/IntroduceVariable/IntroduceVariableTests.cs
...t/CodeActions/IntroduceVariable/IntroduceVariableTests.cs
+10
-12
src/EditorFeatures/CSharpTest/CodeActions/MoveDeclarationNearReference/MoveDeclarationNearReferenceTests.cs
...arationNearReference/MoveDeclarationNearReferenceTests.cs
+5
-11
src/EditorFeatures/CSharpTest/CodeActions/ReplaceMethodWithProperty/ReplaceMethodWithPropertyTests.cs
...placeMethodWithProperty/ReplaceMethodWithPropertyTests.cs
+6
-15
src/EditorFeatures/CSharpTest/Diagnostics/AddUsing/AddUsingTests_ExtensionMethods.cs
...st/Diagnostics/AddUsing/AddUsingTests_ExtensionMethods.cs
+1
-2
src/EditorFeatures/CSharpTest/Diagnostics/FullyQualify/FullyQualifyTests.cs
.../CSharpTest/Diagnostics/FullyQualify/FullyQualifyTests.cs
+4
-8
src/EditorFeatures/CSharpTest/Diagnostics/GenerateConstructor/GenerateConstructorTests.cs
...agnostics/GenerateConstructor/GenerateConstructorTests.cs
+32
-64
src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateMethodTests.cs
...arpTest/Diagnostics/GenerateMethod/GenerateMethodTests.cs
+10
-20
src/EditorFeatures/CSharpTest/Diagnostics/GenerateVariable/GenerateVariableTests.cs
...est/Diagnostics/GenerateVariable/GenerateVariableTests.cs
+8
-16
src/EditorFeatures/CSharpTest/Diagnostics/RemoveUnnecessaryCast/RemoveUnnecessaryCastTests.cs
...stics/RemoveUnnecessaryCast/RemoveUnnecessaryCastTests.cs
+4
-8
src/EditorFeatures/CSharpTest/Diagnostics/UseAutoProperty/UseAutoPropertyTests.cs
...pTest/Diagnostics/UseAutoProperty/UseAutoPropertyTests.cs
+10
-20
src/EditorFeatures/CSharpTest/Diagnostics/UseImplicitOrExplicitType/UseExplicitTypeTests.cs
...nostics/UseImplicitOrExplicitType/UseExplicitTypeTests.cs
+6
-12
src/EditorFeatures/CSharpTest/Diagnostics/UseImplicitOrExplicitType/UseImplicitTypeTests.cs
...nostics/UseImplicitOrExplicitType/UseImplicitTypeTests.cs
+5
-9
src/EditorFeatures/CSharpTest/GenerateFromMembers/AddConstructorParametersFromMembers/AddConstructorParametersFromMembersTests.cs
...rsFromMembers/AddConstructorParametersFromMembersTests.cs
+12
-16
src/EditorFeatures/CSharpTest/GenerateFromMembers/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.cs
...tructorFromMembers/GenerateConstructorFromMembersTests.cs
+2
-5
src/EditorFeatures/CSharpTest/GenerateFromMembers/GenerateEqualsAndGetHashCode/GenerateEqualsAndGetHashCodeTests.cs
...EqualsAndGetHashCode/GenerateEqualsAndGetHashCodeTests.cs
+8
-15
src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs
.../CSharpTest/ImplementInterface/ImplementInterfaceTests.cs
+10
-17
src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
...ies/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
+1
-19
未找到文件。
src/EditorFeatures/CSharpTest/CodeActions/EncapsulateField/EncapsulateFieldTests.cs
浏览文件 @
b9396297
...
...
@@ -31,8 +31,7 @@ protected override CodeRefactoringProvider CreateCodeRefactoringProvider(Workspa
ParseOptions
parseOptions
=
null
,
CompilationOptions
compilationOptions
=
null
,
int
index
=
0
,
bool
compareTokens
=
true
,
IDictionary
<
OptionKey
,
object
>
options
=
null
,
bool
withScriptOption
=
false
)
IDictionary
<
OptionKey
,
object
>
options
=
null
)
{
options
=
options
??
new
Dictionary
<
OptionKey
,
object
>();
foreach
(
var
kvp
in
AllOptionsOff
)
...
...
@@ -41,8 +40,7 @@ protected override CodeRefactoringProvider CreateCodeRefactoringProvider(Workspa
}
return
TestAsync
(
initialMarkup
,
expectedMarkup
,
parseOptions
,
compilationOptions
,
index
,
compareTokens
,
options
,
withScriptOption
:
withScriptOption
);
parseOptions
,
compilationOptions
,
index
,
compareTokens
,
options
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
)]
...
...
@@ -1397,7 +1395,8 @@ void M()
}
}
"
;
await
TestAllOptionsOffAsync
(
text
,
expected
,
compareTokens
:
false
,
index
:
1
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
await
TestAllOptionsOffAsync
(
text
,
expected
,
compareTokens
:
false
,
index
:
1
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
EncapsulateField
),
Test
.
Utilities
.
CompilerTrait
(
Test
.
Utilities
.
CompilerFeature
.
Tuples
)]
...
...
@@ -1439,7 +1438,8 @@ void M()
}
}
"
;
await
TestAllOptionsOffAsync
(
text
,
expected
,
compareTokens
:
false
,
index
:
1
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
await
TestAllOptionsOffAsync
(
text
,
expected
,
compareTokens
:
false
,
index
:
1
);
}
}
}
src/EditorFeatures/CSharpTest/CodeActions/GenerateDefaultConstructors/GenerateDefaultConstructorsTests.cs
浏览文件 @
b9396297
...
...
@@ -761,7 +761,7 @@ static void Main(string[] args)
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateDefaultConstructors
),
Test
.
Utilities
.
CompilerTrait
(
Test
.
Utilities
.
CompilerFeature
.
Tuples
)]
public
async
Task
Tuple
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C : [||]B
{
}
...
...
@@ -784,16 +784,13 @@ class B
public B((int, string) x)
{
}
}"
,
index
:
0
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateDefaultConstructors
),
Test
.
Utilities
.
CompilerTrait
(
Test
.
Utilities
.
CompilerFeature
.
Tuples
)]
public
async
Task
TupleWithNames
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C : [||]B
{
}
...
...
@@ -816,10 +813,7 @@ class B
public B((int a, string b) x)
{
}
}"
,
index
:
0
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
}
}
\ No newline at end of file
src/EditorFeatures/CSharpTest/CodeActions/IntroduceVariable/IntroduceVariableTests.cs
浏览文件 @
b9396297
...
...
@@ -3889,7 +3889,8 @@ public async Task ElementOfTuple()
var i = (1, V).ToString();
}"
;
await
TestAsync
(
code
,
expected
,
index
:
0
,
compareTokens
:
false
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
await
TestInRegularAndScriptAsync
(
code
,
expected
,
compareTokens
:
false
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsIntroduceVariable
)]
...
...
@@ -3908,7 +3909,7 @@ public async Task Tuple_IntroduceConstant()
var i = p.ToString();
}"
;
await
Test
Async
(
code
,
expected
,
index
:
0
,
compareTokens
:
false
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
tru
e
);
await
Test
InRegularAndScriptAsync
(
code
,
expected
,
compareTokens
:
fals
e
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsIntroduceVariable
)]
...
...
@@ -3927,7 +3928,7 @@ public async Task TupleWithNames_IntroduceConstant()
var i = p.ToString();
}"
;
await
Test
Async
(
code
,
expected
,
index
:
0
,
compareTokens
:
false
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
tru
e
);
await
Test
InRegularAndScriptAsync
(
code
,
expected
,
compareTokens
:
fals
e
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsIntroduceVariable
)]
...
...
@@ -3946,7 +3947,7 @@ public async Task Tuple_IntroduceConstantForAllOccurrences()
var i = p.ToString() + p.ToString();
}"
;
await
Test
Async
(
code
,
expected
,
index
:
1
,
compareTokens
:
false
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
tru
e
);
await
Test
InRegularAndScriptAsync
(
code
,
expected
,
index
:
1
,
compareTokens
:
fals
e
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsIntroduceVariable
)]
...
...
@@ -3965,7 +3966,7 @@ public async Task TupleWithNames_IntroduceConstantForAllOccurrences()
var i = p.ToString() + p.ToString();
}"
;
await
Test
Async
(
code
,
expected
,
index
:
1
,
compareTokens
:
false
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
tru
e
);
await
Test
InRegularAndScriptAsync
(
code
,
expected
,
index
:
1
,
compareTokens
:
fals
e
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsIntroduceVariable
)]
...
...
@@ -3984,7 +3985,7 @@ public async Task TupleWithDifferentNames_IntroduceConstantForAllOccurrences()
var i = p.ToString() + (c: 1, d: ""hello"").ToString();
}"
;
await
Test
Async
(
code
,
expected
,
index
:
1
,
compareTokens
:
false
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
tru
e
);
await
Test
InRegularAndScriptAsync
(
code
,
expected
,
index
:
1
,
compareTokens
:
fals
e
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsIntroduceVariable
)]
...
...
@@ -4003,7 +4004,7 @@ public async Task TupleWithOneName_IntroduceConstantForAllOccurrences()
var i = p.ToString() + p.ToString();
}"
;
await
Test
Async
(
code
,
expected
,
index
:
1
,
compareTokens
:
false
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
tru
e
);
await
Test
InRegularAndScriptAsync
(
code
,
expected
,
index
:
1
,
compareTokens
:
fals
e
);
// no third action available
await
TestActionCountAsync
(
code
,
2
,
parseOptions
:
TestOptions
.
Regular
);
...
...
@@ -4014,7 +4015,7 @@ public async Task Tuple_IntroduceLocalForAllOccurrences()
{
// Cannot refactor tuple as local constant
await
Assert
.
ThrowsAsync
<
Xunit
.
Sdk
.
InRangeException
>(()
=>
TestAsync
(
Test
InRegularAndScript
Async
(
@"class C
{
void Foo()
...
...
@@ -4024,10 +4025,7 @@ void Foo()
}
}"
,
@""
,
index
:
3
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
)
);
index
:
3
));
}
[
WorkItem
(
11777
,
"https://github.com/dotnet/roslyn/issues/11777"
)]
...
...
src/EditorFeatures/CSharpTest/CodeActions/MoveDeclarationNearReference/MoveDeclarationNearReferenceTests.cs
浏览文件 @
b9396297
...
...
@@ -590,7 +590,7 @@ static void Main(string[] args)
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsMoveDeclarationNearReference
)]
public
async
Task
Tuple
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
void M()
...
...
@@ -610,16 +610,13 @@ void M()
Console.WriteLine(x);
}
}
}"
,
index
:
0
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsMoveDeclarationNearReference
)]
public
async
Task
TupleWithNames
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
void M()
...
...
@@ -639,10 +636,7 @@ void M()
Console.WriteLine(x);
}
}
}"
,
index
:
0
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
}
}
}
\ No newline at end of file
src/EditorFeatures/CSharpTest/CodeActions/ReplaceMethodWithProperty/ReplaceMethodWithPropertyTests.cs
浏览文件 @
b9396297
...
...
@@ -1215,9 +1215,7 @@ public async Task Tuple()
{
}
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsReplaceMethodWithProperty
)]
...
...
@@ -1251,9 +1249,7 @@ class C
}
}
}"
+
TestResources
.
NetFX
.
ValueTuple
.
tuplelib_cs
,
index
:
1
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
index
:
1
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsReplaceMethodWithProperty
)]
...
...
@@ -1287,9 +1283,7 @@ class C
}
}
}"
+
TestResources
.
NetFX
.
ValueTuple
.
tuplelib_cs
,
index
:
1
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
index
:
1
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsReplaceMethodWithProperty
)]
...
...
@@ -1311,9 +1305,7 @@ void setFoo((int c, string d) i)
}
}"
,
@""
,
index
:
1
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
));
index
:
1
));
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsReplaceMethodWithProperty
)]
...
...
@@ -1691,14 +1683,13 @@ public async Task TestCodeStyle10()
private
async
Task
TestWithAllCodeStyleOff
(
string
initialMarkup
,
string
expectedMarkup
,
ParseOptions
parseOptions
=
null
,
int
index
=
0
,
bool
compareTokens
=
true
,
bool
withScriptOption
=
false
)
bool
compareTokens
=
true
)
{
await
TestAsync
(
initialMarkup
,
expectedMarkup
,
parseOptions
,
index
:
index
,
compareTokens
:
compareTokens
,
options
:
AllCodeStyleOff
,
withScriptOption
:
withScriptOption
);
options
:
AllCodeStyleOff
);
}
private
IDictionary
<
OptionKey
,
object
>
AllCodeStyleOff
=>
...
...
src/EditorFeatures/CSharpTest/Diagnostics/AddUsing/AddUsingTests_ExtensionMethods.cs
浏览文件 @
b9396297
...
...
@@ -1106,8 +1106,7 @@ static class E
public static void Deconstruct(this Program p, out int x, out int y) { }
}
}"
,
parseOptions
:
null
,
withScriptOption
:
false
);
parseOptions
:
null
);
}
}
}
\ No newline at end of file
src/EditorFeatures/CSharpTest/Diagnostics/FullyQualify/FullyQualifyTests.cs
浏览文件 @
b9396297
...
...
@@ -1239,7 +1239,7 @@ class CAttribute
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsFullyQualify
)]
public
async
Task
TupleTest
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Class
{
([|IDictionary|], string) Method()
...
...
@@ -1253,15 +1253,13 @@ public async Task TupleTest()
{
Foo();
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsFullyQualify
)]
public
async
Task
TupleWithOneName
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Class
{
([|IDictionary|] a, string) Method()
...
...
@@ -1275,9 +1273,7 @@ public async Task TupleWithOneName()
{
Foo();
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
}
}
\ No newline at end of file
src/EditorFeatures/CSharpTest/Diagnostics/GenerateConstructor/GenerateConstructorTests.cs
浏览文件 @
b9396297
...
...
@@ -2439,7 +2439,7 @@ public bool M(string s, int i, bool b)
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
public
async
Task
Tuple
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
void M()
...
...
@@ -2462,15 +2462,13 @@ void M()
{
new C((1, ""hello""), true);
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
public
async
Task
TupleWithNames
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
void M()
...
...
@@ -2491,15 +2489,13 @@ void M()
{
new C((a: 1, b: ""hello""));
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
public
async
Task
TupleWithOneName
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
void M()
...
...
@@ -2520,15 +2516,13 @@ void M()
{
new C((a: 1, ""hello""));
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
public
async
Task
TupleAndExistingField
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
void M()
...
...
@@ -2557,15 +2551,13 @@ public D((int, string) existing)
{
this.existing = existing;
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
public
async
Task
TupleWithNamesAndExistingField
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
void M()
...
...
@@ -2594,15 +2586,13 @@ public D((int a, string b) existing)
{
this.existing = existing;
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
public
async
Task
TupleWithDifferentNamesAndExistingField
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
void M()
...
...
@@ -2631,15 +2621,13 @@ public D((int a, string b) existing)
{
this.existing = existing;
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
public
async
Task
TupleAndDelegatingConstructor
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
void M()
...
...
@@ -2678,15 +2666,13 @@ class D : B
public D((int, string) x) : base(x)
{
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
public
async
Task
TupleWithNamesAndDelegatingConstructor
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
void M()
...
...
@@ -2725,15 +2711,13 @@ class D : B
public D((int a, string b) x) : base(x)
{
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
public
async
Task
TupleWithDifferentNamesAndDelegatingConstructor
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
void M()
...
...
@@ -2772,9 +2756,7 @@ class D : B
public D((int c, string d) x) : base(x)
{
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
...
...
@@ -2863,7 +2845,7 @@ public D(int _)
[
WorkItem
(
12147
,
"https://github.com/dotnet/roslyn/issues/12147"
)]
public
async
Task
TestOutVariableDeclaration_ImplicitlyTyped
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
void M()
...
...
@@ -2882,16 +2864,14 @@ void M()
{
new C(out var a);
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
[
WorkItem
(
12147
,
"https://github.com/dotnet/roslyn/issues/12147"
)]
public
async
Task
TestOutVariableDeclaration_ImplicitlyTyped_NamedArgument
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
void M()
...
...
@@ -2910,16 +2890,14 @@ void M()
{
new C(b: out var a);
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
[
WorkItem
(
12147
,
"https://github.com/dotnet/roslyn/issues/12147"
)]
public
async
Task
TestOutVariableDeclaration_ExplicitlyTyped
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
void M()
...
...
@@ -2938,16 +2916,14 @@ void M()
{
new C(out int a);
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
[
WorkItem
(
12147
,
"https://github.com/dotnet/roslyn/issues/12147"
)]
public
async
Task
TestOutVariableDeclaration_ExplicitlyTyped_NamedArgument
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
void M()
...
...
@@ -2966,9 +2942,7 @@ void M()
{
new C(b: out int a);
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
...
...
@@ -2995,8 +2969,7 @@ void M()
new C(out var a);
}
}"
,
parseOptions
:
TestOptions
.
Regular
.
WithLanguageVersion
(
CodeAnalysis
.
CSharp
.
LanguageVersion
.
CSharp6
),
withScriptOption
:
true
);
parseOptions
:
TestOptions
.
Regular
.
WithLanguageVersion
(
CodeAnalysis
.
CSharp
.
LanguageVersion
.
CSharp6
));
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
...
...
@@ -3023,8 +2996,7 @@ void M()
new C(b: out var a);
}
}"
,
parseOptions
:
TestOptions
.
Regular
.
WithLanguageVersion
(
CodeAnalysis
.
CSharp
.
LanguageVersion
.
CSharp6
),
withScriptOption
:
true
);
parseOptions
:
TestOptions
.
Regular
.
WithLanguageVersion
(
CodeAnalysis
.
CSharp
.
LanguageVersion
.
CSharp6
));
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
...
...
@@ -3051,8 +3023,7 @@ void M()
new C(out int a);
}
}"
,
parseOptions
:
TestOptions
.
Regular
.
WithLanguageVersion
(
CodeAnalysis
.
CSharp
.
LanguageVersion
.
CSharp6
),
withScriptOption
:
true
);
parseOptions
:
TestOptions
.
Regular
.
WithLanguageVersion
(
CodeAnalysis
.
CSharp
.
LanguageVersion
.
CSharp6
));
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
...
...
@@ -3079,15 +3050,14 @@ void M()
new C(b: out int a);
}
}"
,
parseOptions
:
TestOptions
.
Regular
.
WithLanguageVersion
(
CodeAnalysis
.
CSharp
.
LanguageVersion
.
CSharp6
),
withScriptOption
:
true
);
parseOptions
:
TestOptions
.
Regular
.
WithLanguageVersion
(
CodeAnalysis
.
CSharp
.
LanguageVersion
.
CSharp6
));
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructor
)]
[
WorkItem
(
13749
,
"https://github.com/dotnet/roslyn/issues/13749"
)]
public
async
Task
Support_Readonly_Properties
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C {
public int Prop { get ; }
}
...
...
@@ -3110,9 +3080,7 @@ class P {
var prop = 42 ;
var c = new C ( prop ) ;
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
}
}
\ No newline at end of file
src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateMethodTests.cs
浏览文件 @
b9396297
...
...
@@ -6869,7 +6869,7 @@ private T First<T>(List<T> list)
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateMethod
)]
public
async
Task
MethodWithTuple
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Class
{
void Method()
...
...
@@ -6890,15 +6890,13 @@ void Method()
{
throw new NotImplementedException();
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateMethod
)]
public
async
Task
MethodWithTupleWithNames
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Class
{
void Method()
...
...
@@ -6919,15 +6917,13 @@ void Method()
{
throw new NotImplementedException();
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateMethod
)]
public
async
Task
MethodWithTupleWithOneName
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Class
{
void Method()
...
...
@@ -6948,9 +6944,7 @@ void Method()
{
throw new NotImplementedException();
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateMethod
)]
...
...
@@ -7090,8 +7084,7 @@ private void Undefined(out object c)
throw new NotImplementedException();
}
}"
,
parseOptions
:
TestOptions
.
Regular
.
WithLanguageVersion
(
CodeAnalysis
.
CSharp
.
LanguageVersion
.
CSharp6
),
withScriptOption
:
true
);
parseOptions
:
TestOptions
.
Regular
.
WithLanguageVersion
(
CodeAnalysis
.
CSharp
.
LanguageVersion
.
CSharp6
));
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateMethod
)]
...
...
@@ -7119,8 +7112,7 @@ private void Undefined(out int c)
throw new NotImplementedException();
}
}"
,
parseOptions
:
TestOptions
.
Regular
.
WithLanguageVersion
(
CodeAnalysis
.
CSharp
.
LanguageVersion
.
CSharp6
),
withScriptOption
:
true
);
parseOptions
:
TestOptions
.
Regular
.
WithLanguageVersion
(
CodeAnalysis
.
CSharp
.
LanguageVersion
.
CSharp6
));
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateMethod
)]
...
...
@@ -7148,8 +7140,7 @@ private void Undefined(out object a)
throw new NotImplementedException();
}
}"
,
parseOptions
:
TestOptions
.
Regular
.
WithLanguageVersion
(
CodeAnalysis
.
CSharp
.
LanguageVersion
.
CSharp6
),
withScriptOption
:
true
);
parseOptions
:
TestOptions
.
Regular
.
WithLanguageVersion
(
CodeAnalysis
.
CSharp
.
LanguageVersion
.
CSharp6
));
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateMethod
)]
...
...
@@ -7177,8 +7168,7 @@ private void Undefined(out int a)
throw new NotImplementedException();
}
}"
,
parseOptions
:
TestOptions
.
Regular
.
WithLanguageVersion
(
CodeAnalysis
.
CSharp
.
LanguageVersion
.
CSharp6
),
withScriptOption
:
true
);
parseOptions
:
TestOptions
.
Regular
.
WithLanguageVersion
(
CodeAnalysis
.
CSharp
.
LanguageVersion
.
CSharp6
));
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateMethod
)]
...
...
src/EditorFeatures/CSharpTest/Diagnostics/GenerateVariable/GenerateVariableTests.cs
浏览文件 @
b9396297
...
...
@@ -7029,7 +7029,7 @@ static C()
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateVariable
)]
public
async
Task
TupleRead
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Class
{
void Method((int, string) i)
...
...
@@ -7045,15 +7045,13 @@ void Method((int, string) i)
{
Method(tuple);
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateVariable
)]
public
async
Task
TupleWithOneNameRead
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Class
{
void Method((int a, string) i)
...
...
@@ -7069,15 +7067,13 @@ void Method((int a, string) i)
{
Method(tuple);
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateVariable
)]
public
async
Task
TupleWrite
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Class
{
void Method()
...
...
@@ -7093,15 +7089,13 @@ void Method()
{
tuple = (1, ""hello"");
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateVariable
)]
public
async
Task
TupleWithOneNameWrite
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Class
{
void Method()
...
...
@@ -7117,9 +7111,7 @@ void Method()
{
tuple = (a: 1, ""hello"");
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateVariable
)]
...
...
src/EditorFeatures/CSharpTest/Diagnostics/RemoveUnnecessaryCast/RemoveUnnecessaryCastTests.cs
浏览文件 @
b9396297
...
...
@@ -3858,7 +3858,7 @@ public enum Directions
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnnecessaryCast
)]
public
async
Task
Tuple
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
void Main()
...
...
@@ -3872,15 +3872,13 @@ void Main()
{
(int, string) tuple = (1, ""hello"");
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnnecessaryCast
)]
public
async
Task
TupleWithDifferentNames
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
void Main()
...
...
@@ -3894,9 +3892,7 @@ void Main()
{
(int a, string) tuple = (1, f: ""hello"");
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
WorkItem
(
12572
,
"https://github.com/dotnet/roslyn/issues/12572"
)]
...
...
src/EditorFeatures/CSharpTest/Diagnostics/UseAutoProperty/UseAutoPropertyTests.cs
浏览文件 @
b9396297
...
...
@@ -819,7 +819,7 @@ int P
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsUseAutoProperty
)]
public
async
Task
Tuple_SingleGetterFromField
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Class
{
[|(int, string) i|];
...
...
@@ -835,15 +835,13 @@ public async Task Tuple_SingleGetterFromField()
@"class Class
{
(int, string) P { get; }
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsUseAutoProperty
)]
public
async
Task
TupleWithNames_SingleGetterFromField
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Class
{
[|(int a, string b) i|];
...
...
@@ -859,9 +857,7 @@ public async Task TupleWithNames_SingleGetterFromField()
@"class Class
{
(int a, string b) P { get; }
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsUseAutoProperty
)]
...
...
@@ -885,7 +881,7 @@ public async Task TupleWithDifferentNames_SingleGetterFromField()
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsUseAutoProperty
)]
public
async
Task
TupleWithOneName_SingleGetterFromField
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Class
{
[|(int a, string) i|];
...
...
@@ -901,15 +897,13 @@ public async Task TupleWithOneName_SingleGetterFromField()
@"class Class
{
(int a, string) P { get; }
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsUseAutoProperty
)]
public
async
Task
Tuple_Initializer
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Class
{
[|(int, string) i = (1, ""hello"")|];
...
...
@@ -925,15 +919,13 @@ public async Task Tuple_Initializer()
@"class Class
{
(int, string) P { get; } = (1, ""hello"");
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsUseAutoProperty
)]
public
async
Task
Tuple_GetterAndSetter
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Class
{
[|(int, string) i|];
...
...
@@ -954,9 +946,7 @@ public async Task Tuple_GetterAndSetter()
@"class Class
{
(int, string) P { get; set; }
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
}
}
\ No newline at end of file
src/EditorFeatures/CSharpTest/Diagnostics/UseImplicitOrExplicitType/UseExplicitTypeTests.cs
浏览文件 @
b9396297
...
...
@@ -1126,7 +1126,7 @@ static void M()
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsUseExplicitType
)]
public
async
Task
SuggestExplicitTypeOnLocalWithIntrinsicTypeTuple
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
static void M()
...
...
@@ -1141,15 +1141,13 @@ static void M()
(int, string) s = (1, ""hello"");
}
}"
,
options
:
ExplicitTypeEverywhere
(),
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
options
:
ExplicitTypeEverywhere
());
}
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsUseExplicitType
)]
public
async
Task
SuggestExplicitTypeOnLocalWithIntrinsicTypeTupleWithNames
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
static void M()
...
...
@@ -1164,15 +1162,13 @@ static void M()
(int a, string b) s = (a: 1, b: ""hello"");
}
}"
,
options
:
ExplicitTypeEverywhere
(),
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
options
:
ExplicitTypeEverywhere
());
}
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsUseExplicitType
)]
public
async
Task
SuggestExplicitTypeOnLocalWithIntrinsicTypeTupleWithOneName
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class C
{
static void M()
...
...
@@ -1187,9 +1183,7 @@ static void M()
(int a, string) s = (a: 1, ""hello"");
}
}"
,
options
:
ExplicitTypeEverywhere
(),
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
options
:
ExplicitTypeEverywhere
());
}
}
}
\ No newline at end of file
src/EditorFeatures/CSharpTest/Diagnostics/UseImplicitOrExplicitType/UseImplicitTypeTests.cs
浏览文件 @
b9396297
...
...
@@ -1555,7 +1555,7 @@ public async Task SuggestVarOnLocalWithIntrinsicTypeTuple()
var
before
=
@"class C { static void M() { [|(int a, string)|] s = (a: 1, ""hello""); } }"
;
var
after
=
@"class C { static void M() { var s = (a: 1, ""hello""); } }"
;
await
Test
Async
(
before
,
after
,
options
:
ImplicitTypeEverywhere
(),
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
await
Test
InRegularAndScriptAsync
(
before
,
after
,
options
:
ImplicitTypeEverywhere
()
);
// We would rather this refactoring also worked. See https://github.com/dotnet/roslyn/issues/11094
await
TestMissingInRegularAndScriptAsync
(
before
,
options
:
ImplicitTypeWhereApparent
());
...
...
@@ -1564,7 +1564,7 @@ public async Task SuggestVarOnLocalWithIntrinsicTypeTuple()
[
WpfFact
(
Skip
=
"https://github.com/dotnet/roslyn/issues/11154"
),
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsUseImplicitType
)]
public
async
Task
ValueTupleCreate
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"using System;
class C
...
...
@@ -1583,9 +1583,7 @@ static void M()
var s = ValueTuple.Create(1, 1);
}
}"
+
trivial2uple
,
options
:
ImplicitTypeWhereApparent
(),
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
options
:
ImplicitTypeWhereApparent
());
}
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsUseImplicitType
)]
...
...
@@ -1642,7 +1640,7 @@ static void M()
[
WorkItem
(
14052
,
"https://github.com/dotnet/roslyn/issues/14052"
)]
public
async
Task
OfferOnForEachConversionIfItDoesNotChangesSemantics
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"using System;
using System.Collections.Generic;
...
...
@@ -1699,9 +1697,7 @@ static void M()
}
}
}"
,
options
:
ImplicitTypeEverywhere
(),
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
options
:
ImplicitTypeEverywhere
());
}
}
}
\ No newline at end of file
src/EditorFeatures/CSharpTest/GenerateFromMembers/AddConstructorParametersFromMembers/AddConstructorParametersFromMembersTests.cs
浏览文件 @
b9396297
...
...
@@ -210,7 +210,7 @@ public Program(bool b)
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsAddConstructorParametersFromMembers
)]
public
async
Task
TestTuple
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Program
{
[|(int, string) i;
...
...
@@ -231,14 +231,13 @@ public Program((int, string) i, (string, int) s)
this.i = i;
this.s = s;
}
}"
,
index
:
0
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsAddConstructorParametersFromMembers
)]
public
async
Task
TestTupleWithNames
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Program
{
[|(int a, string b) i;
...
...
@@ -259,8 +258,7 @@ public Program((int a, string b) i, (string c, int d) s)
this.i = i;
this.s = s;
}
}"
,
index
:
0
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsAddConstructorParametersFromMembers
)]
...
...
@@ -282,7 +280,7 @@ public Program((int e, string f) i)
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsAddConstructorParametersFromMembers
)]
public
async
Task
TestTupleOptional
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Program
{
[|(int, string) i;
...
...
@@ -304,13 +302,13 @@ public Program((int, string) i, (string, int) s = default((string, int)))
this.s = s;
}
}"
,
index
:
1
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
index
:
1
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsAddConstructorParametersFromMembers
)]
public
async
Task
TestTupleOptionalWithNames
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Program
{
[|(int a, string b) i;
...
...
@@ -332,7 +330,7 @@ public Program((int a, string b) i, (string c, int d) s = default((string c, int
this.s = s;
}
}"
,
index
:
1
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
index
:
1
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsAddConstructorParametersFromMembers
)]
...
...
@@ -354,7 +352,7 @@ public Program((int e, string f) i)
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsAddConstructorParametersFromMembers
)]
public
async
Task
TestTupleWithNullable
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Program
{
[|(int?, bool?) i;
...
...
@@ -375,14 +373,13 @@ public Program((int?, bool?) i, (byte?, long?) s)
this.i = i;
this.s = s;
}
}"
,
index
:
0
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsAddConstructorParametersFromMembers
)]
public
async
Task
TestTupleWithGenericss
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"class Program
{
[|(List<int>, List<bool>) i;
...
...
@@ -403,8 +400,7 @@ public Program((List<int>, List<bool>) i, (List<byte>, List<long>) s)
this.i = i;
this.s = s;
}
}"
,
index
:
0
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
}
}
src/EditorFeatures/CSharpTest/GenerateFromMembers/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.cs
浏览文件 @
b9396297
...
...
@@ -529,7 +529,7 @@ static void Test()
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateConstructorFromMembers
)]
public
async
Task
Tuple
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"using System.Collections.Generic;
class Z
...
...
@@ -546,10 +546,7 @@ public Z((int, string) a)
{
this.a = a;
}
}"
,
index
:
0
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
WorkItem
(
14219
,
"https://github.com/dotnet/roslyn/issues/14219"
)]
...
...
src/EditorFeatures/CSharpTest/GenerateFromMembers/GenerateEqualsAndGetHashCode/GenerateEqualsAndGetHashCodeTests.cs
浏览文件 @
b9396297
...
...
@@ -520,7 +520,7 @@ public override bool Equals(object obj)
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateEqualsAndGetHashCode
)]
public
async
Task
Tuples_Equals
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"using System.Collections.Generic;
class C
...
...
@@ -538,15 +538,13 @@ public override bool Equals(object obj)
var c = obj as C;
return c != null && EqualityComparer<(int, string)>.Default.Equals(a, c.a);
}
}"
,
index
:
0
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateEqualsAndGetHashCode
)]
public
async
Task
TupleWithNames_Equals
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"using System.Collections.Generic;
class C
...
...
@@ -564,15 +562,13 @@ public override bool Equals(object obj)
var c = obj as C;
return c != null && EqualityComparer<(int x, string y)>.Default.Equals(a, c.a);
}
}"
,
index
:
0
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateEqualsAndGetHashCode
)]
public
async
Task
Tuple_HashCode
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"using System.Collections.Generic;
class Program
...
...
@@ -590,14 +586,13 @@ public override int GetHashCode()
return EqualityComparer<(int, string)>.Default.GetHashCode(i);
}
}"
,
index
:
1
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
index
:
1
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateEqualsAndGetHashCode
)]
public
async
Task
TupleWithNames_HashCode
()
{
await
TestAsync
(
await
Test
InRegularAndScript
Async
(
@"using System.Collections.Generic;
class Program
...
...
@@ -615,9 +610,7 @@ public override int GetHashCode()
return EqualityComparer<(int x, string y)>.Default.GetHashCode(i);
}
}"
,
index
:
1
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
index
:
1
);
}
}
}
src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs
浏览文件 @
b9396297
...
...
@@ -58,31 +58,28 @@ internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProvider
internal
async
Task
TestWithAllCodeStyleOptionsOffAsync
(
string
initialMarkup
,
string
expectedMarkup
,
int
index
=
0
,
bool
compareTokens
=
true
,
ParseOptions
parseOptions
=
null
,
bool
withScriptOption
=
false
)
ParseOptions
parseOptions
=
null
)
{
await
TestAsync
(
initialMarkup
,
expectedMarkup
,
parseOptions
,
null
,
index
,
compareTokens
,
options
:
s_allOptionsOff
,
withScriptOption
:
withScriptOption
);
index
,
compareTokens
,
options
:
s_allOptionsOff
);
}
internal
async
Task
TestWithAllCodeStyleOptionsOnAsync
(
string
initialMarkup
,
string
expectedMarkup
,
int
index
=
0
,
bool
compareTokens
=
true
,
ParseOptions
parseOptions
=
null
,
bool
withScriptOption
=
false
)
ParseOptions
parseOptions
=
null
)
{
await
TestAsync
(
initialMarkup
,
expectedMarkup
,
parseOptions
,
null
,
index
,
compareTokens
,
options
:
s_allOptionsOn
,
withScriptOption
:
withScriptOption
);
index
,
compareTokens
,
options
:
s_allOptionsOn
);
}
internal
async
Task
TestWithAccessorCodeStyleOptionsOnAsync
(
string
initialMarkup
,
string
expectedMarkup
,
int
index
=
0
,
bool
compareTokens
=
true
,
ParseOptions
parseOptions
=
null
,
bool
withScriptOption
=
false
)
ParseOptions
parseOptions
=
null
)
{
await
TestAsync
(
initialMarkup
,
expectedMarkup
,
parseOptions
,
null
,
index
,
compareTokens
,
options
:
s_accessorOptionsOn
,
withScriptOption
:
withScriptOption
);
index
,
compareTokens
,
options
:
s_accessorOptionsOn
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsImplementInterface
)]
...
...
@@ -6520,8 +6517,7 @@ class Class : IInterface
{
throw new System.NotImplementedException();
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsImplementInterface
)]
...
...
@@ -6550,8 +6546,7 @@ class Class : IInterface
{
throw new System.NotImplementedException();
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsImplementInterface
)]
...
...
@@ -6580,8 +6575,7 @@ class Class : IInterface<(int, string), int>
{
throw new System.NotImplementedException();
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsImplementInterface
)]
...
...
@@ -6610,8 +6604,7 @@ class Class : IInterface<(int, string), int>
{
throw new System.NotImplementedException();
}
}"
,
parseOptions
:
TestOptions
.
Regular
,
withScriptOption
:
true
);
}"
);
}
[
WorkItem
(
15387
,
"https://github.com/dotnet/roslyn/issues/15387"
)]
...
...
src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
浏览文件 @
b9396297
...
...
@@ -327,25 +327,7 @@ public abstract class AbstractCodeActionOrUserDiagnosticTest
IDictionary
<
OptionKey
,
object
>
options
=
null
,
string
fixAllActionEquivalenceKey
=
null
,
object
fixProviderData
=
null
,
CodeActionPriority
?
priority
=
null
,
bool
withScriptOption
=
false
)
{
await
TestAsync
(
initialMarkup
,
expectedMarkup
,
parseOptions
,
compilationOptions
,
index
,
compareTokens
,
options
,
fixAllActionEquivalenceKey
,
fixProviderData
,
priority
);
if
(
withScriptOption
)
{
await
TestAsync
(
initialMarkup
,
expectedMarkup
,
parseOptions
.
WithKind
(
SourceCodeKind
.
Script
),
compilationOptions
,
index
,
compareTokens
,
options
,
fixAllActionEquivalenceKey
,
fixProviderData
,
priority
);
}
}
private
async
Task
TestAsync
(
string
initialMarkup
,
string
expectedMarkup
,
ParseOptions
parseOptions
,
CompilationOptions
compilationOptions
,
int
index
,
bool
compareTokens
,
IDictionary
<
OptionKey
,
object
>
options
,
string
fixAllActionEquivalenceKey
,
object
fixProviderData
,
CodeActionPriority
?
priority
)
CodeActionPriority
?
priority
=
null
)
{
MarkupTestFile
.
GetSpans
(
expectedMarkup
.
NormalizeLineEndings
(),
out
var
expected
,
out
IDictionary
<
string
,
IList
<
TextSpan
>>
spanMap
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录