Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
cad5f7a1
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,发现更多精彩内容 >>
提交
cad5f7a1
编写于
7月 03, 2019
作者:
P
Petr Houška
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add general tests for RefactoringHelpersService.
上级
296a333c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
537 addition
and
3 deletion
+537
-3
src/EditorFeatures/CSharpTest/RefactoringHelpers/RefactoringHelpersTests.cs
.../CSharpTest/RefactoringHelpers/RefactoringHelpersTests.cs
+537
-3
未找到文件。
src/EditorFeatures/CSharpTest/RefactoringHelpers/RefactoringHelpersTests.cs
浏览文件 @
cad5f7a1
...
...
@@ -4,6 +4,7 @@
using
Microsoft.CodeAnalysis.CSharp.Syntax
;
using
Microsoft.CodeAnalysis.Editor.UnitTests.RefactoringHelpers
;
using
Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
;
using
Roslyn.Test.Utilities
;
using
Xunit
;
namespace
Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RefactoringHelpers
...
...
@@ -14,15 +15,17 @@ public RefactoringHelpersTests(CSharpTestWorkspaceFixture workspaceFixture) : ba
{
}
#
region
Locations
[
Fact
]
public
async
Task
Test1
()
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestInTokenDirectlyUnderNode
()
{
var
testText
=
@"
class C
{
void M()
{
[||]{|result:C Local
Function(C c)
{|result:C Local[||]
Function(C c)
{
return null;
}|}
...
...
@@ -32,7 +35,252 @@ void M()
}
[
Fact
]
public
async
Task
Test2
()
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestBeforeTokenDirectlyUnderNode
()
{
var
testText
=
@"
class C
{
void M()
{
{|result:C [||]LocalFunction(C c)
{
return null;
}|}
}
}"
;
await
TestAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestAfterTokenDirectlyUnderNode
()
{
var
testText
=
@"
class C
{
void M()
{
{|result:C [||]LocalFunction(C c)
{
return null;
}|}
}
}"
;
await
TestAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestMissingInTokenUnderDifferentNode
()
{
var
testText
=
@"
class C
{
void M()
{
C[||] LocalFunction(C c)
{
return null;
}
}
}"
;
await
TestMissingAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestClimbRightEdge
()
{
var
testText
=
@"
class C
{
void M()
{
{|result:C LocalFunction(C c)
{
return null;
}[||]|}
}
}"
;
await
TestAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestClimbLeftEdge
()
{
var
testText
=
@"
class C
{
void M()
{
{|result:[||]C LocalFunction(C c)
{
return null;
}|}
}
}"
;
await
TestAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestClimbLeftEdgeComments
()
{
var
testText
=
@"
class C
{
void M()
{
/// <summary>
/// Comment1
/// </summary>
{|result:[||]C LocalFunction(C c)
{
return null;
}|}
}
}"
;
await
TestAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestMissingInAnotherChildNode
()
{
var
testText
=
@"
class C
{
void M()
{
C LocalFunction(C c)
{
[||]return null;
}
}
}"
;
await
TestMissingAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestMissingLocationAfter
()
{
var
testText
=
@"
class C
{
void M()
{
C LocalFunction(C c)
{
return null;
}
[||]
}
}"
;
await
TestMissingAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestMissingLocationBefore
()
{
var
testText
=
@"
class C
{
void M()
{
[||]
C LocalFunction(C c)
{
return null;
}
}
}"
;
await
TestMissingAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestMissingLocationBefore2
()
{
var
testText
=
@"
class C
{
void M()
{
var a = new object();[||]
C LocalFunction(C c)
{
return null;
}
}
}"
;
await
TestMissingAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
#
endregion
#
region
Selections
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestSelectedTokenDirectlyUnderNode
()
{
var
testText
=
@"
class C
{
void M()
{
{|result:C [|LocalFunction|](C c)
{
return null;
}|}
}
}"
;
await
TestAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestPartiallySelectedTokenDirectlyUnderNode
()
{
var
testText
=
@"
class C
{
void M()
{
{|result:C Lo[|calFunct|]ion(C c)
{
return null;
}|}
}
}"
;
await
TestAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestSelectedMultipleTokensUnderNode
()
{
var
testText
=
@"
class C
{
void M()
{
{|result:[|C LocalFunction(C c)|]
{
return null;
}|}
}
}"
;
await
TestAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestMissingSelectedMultipleTokensWithLowerCommonAncestor
()
{
var
testText
=
@"
class C
...
...
@@ -48,5 +296,291 @@ C LocalFunction(C c)
await
TestMissingAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestCompleteSelection
()
{
var
testText
=
@"
class C
{
void M()
{
{|result:[|C LocalFunction(C c)
{
return null;
}|]|}
}
}"
;
await
TestAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestOverSelection
()
{
var
testText
=
@"
class C
{
void M()
{
[|
{|result:C LocalFunction(C c)
{
return null;
}|}
|]var a = new object();
}
}"
;
await
TestAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestOverSelectionComments
()
{
var
testText
=
@"
class C
{
void M()
{
// Co[|mment1
{|result:C LocalFunction(C c)
{
return null;
}|}|]
}
}"
;
await
TestAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestMissingOverSelection
()
{
var
testText
=
@"
class C
{
void M()
{
[|
C LocalFunction(C c)
{
return null;
}
v|]ar a = new object();
}
}"
;
await
TestMissingAsync
<
LocalFunctionStatementSyntax
>(
testText
);
}
#
endregion
#
region
Attributes
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestClimbLeftEdgeBeforeAttribute
()
{
var
testText
=
@"
using System;
class C
{
class TestAttribute : Attribute { }
// Comment1
[||]{|result:[Test]
void M()
{
}|}
}"
;
await
TestAsync
<
MethodDeclarationSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestClimbLeftEdgeAfterAttribute
()
{
var
testText
=
@"
using System;
class C
{
class TestAttribute : Attribute { }
{|result:[Test]
[||]void M()
{
}|}
}"
;
await
TestAsync
<
MethodDeclarationSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestClimbLeftEdgeAfterAttributeComments
()
{
var
testText
=
@"
using System;
class C
{
class TestAttribute : Attribute { }
// Comment1
{|result:[Test]
// Comment2
[||]void M()
{
}|}
}"
;
await
TestAsync
<
MethodDeclarationSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestClimbLeftEdgeAfterAttributes
()
{
var
testText
=
@"
using System;
class C
{
class TestAttribute : Attribute { }
class Test2Attribute : Attribute { }
// Comment1
{|result:[Test]
[Test2]
// Comment2
[||]void M()
{
}|}
}"
;
await
TestAsync
<
MethodDeclarationSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestMissingBetweenAttributes
()
{
var
testText
=
@"
using System;
class C
{
class TestAttribute : Attribute { }
class Test2Attribute : Attribute { }
[Test]
[||][Test2]
void M()
{
}
}"
;
await
TestMissingAsync
<
MethodDeclarationSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestMissingBetweenInAttributes
()
{
var
testText
=
@"
using System;
class C
{
class TestAttribute : Attribute { }
[[||]Test]
void M()
{
}
}"
;
await
TestMissingAsync
<
MethodDeclarationSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestMissingSelectedAttributes
()
{
var
testText
=
@"
using System;
class C
{
class TestAttribute : Attribute { }
class Test2Attribute : Attribute { }
[|[Test]
[Test2]|]
void M()
{
}
}"
;
await
TestMissingAsync
<
MethodDeclarationSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestMissingSelectedAttribute
()
{
var
testText
=
@"
using System;
class C
{
class TestAttribute : Attribute { }
[|[Test]|]
void M()
{
}
}"
;
await
TestMissingAsync
<
MethodDeclarationSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestSelectedWholeNodeAndAttributes
()
{
var
testText
=
@"
using System;
class C
{
class TestAttribute : Attribute { }
class Test2Attribute : Attribute { }
// Comment1
[|{|result:[Test]
[Test2]
// Comment2
void M()
{
}|}|]
}"
;
await
TestAsync
<
MethodDeclarationSyntax
>(
testText
);
}
[
Fact
]
[
WorkItem
(
35525
,
"https://github.com/dotnet/roslyn/issues/35525"
)]
public
async
Task
TestSelectedWholeNodeWithoutAttributes
()
{
var
testText
=
@"
using System;
class C
{
class TestAttribute : Attribute { }
class Test2Attribute : Attribute { }
// Comment1
{|result:[Test]
[Test2]
// Comment2
[|void M()
{
}|]|}
}"
;
await
TestAsync
<
MethodDeclarationSyntax
>(
testText
);
}
#
endregion
#
region
Extractions
#
endregion
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录