Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
1395a762
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,发现更多精彩内容 >>
提交
1395a762
编写于
1月 31, 2017
作者:
J
Julien Couvreur
提交者:
GitHub
1月 31, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adding some refactoring tests with tuples (#16663)
上级
85501ae9
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
190 addition
and
0 deletion
+190
-0
src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeTests.cs
.../CSharpTest/Diagnostics/GenerateType/GenerateTypeTests.cs
+50
-0
src/EditorFeatures/CSharpTest/ImplementAbstractClass/ImplementAbstractClassTests.cs
...est/ImplementAbstractClass/ImplementAbstractClassTests.cs
+29
-0
src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs
.../CSharpTest/ImplementInterface/ImplementInterfaceTests.cs
+28
-0
src/EditorFeatures/VisualBasicTest/Diagnostics/GenerateType/GenerateTypeTests.vb
...alBasicTest/Diagnostics/GenerateType/GenerateTypeTests.vb
+40
-0
src/EditorFeatures/VisualBasicTest/ImplementAbstractClass/ImplementAbstractClassTests.vb
...est/ImplementAbstractClass/ImplementAbstractClassTests.vb
+21
-0
src/EditorFeatures/VisualBasicTest/ImplementInterface/ImplementInterfaceTests.vb
...alBasicTest/ImplementInterface/ImplementInterfaceTests.vb
+22
-0
未找到文件。
src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeTests.cs
浏览文件 @
1395a762
...
...
@@ -267,6 +267,56 @@ public Foo()
index
:
2
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateType
)]
public
async
Task
TestGenerateClassWithCtorFromObjectCreationWithTuple
()
{
await
TestAsync
(
@"class Class
{
var f = new [|Generated|]((1, 2));
}"
,
@"class Class
{
var f = new Generated((1, 2));
private class Generated
{
private (int, int) p;
public Generated((int, int) p)
{
this.p = p;
}
}
}"
,
index
:
2
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateType
)]
public
async
Task
TestGenerateClassWithCtorFromObjectCreationWithTupleWithNames
()
{
await
TestAsync
(
@"class Class
{
var f = new [|Generated|]((a: 1, b: 2, 3));
}"
,
@"class Class
{
var f = new Generated((a: 1, b: 2, 3));
private class Generated
{
private (int a, int b, int) p;
public Generated((int a, int b, int) p)
{
this.p = p;
}
}
}"
,
index
:
2
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateType
)]
public
async
Task
TestGenerateClassFromBaseList
()
{
...
...
src/EditorFeatures/CSharpTest/ImplementAbstractClass/ImplementAbstractClassTests.cs
浏览文件 @
1395a762
...
...
@@ -105,6 +105,35 @@ protected override string FooMethod()
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsImplementAbstractClass
)]
[
WorkItem
(
16434
,
"https://github.com/dotnet/roslyn/issues/16434"
)]
public
async
Task
TestMethodWithTupleNames
()
{
await
TestAllOptionsOffAsync
(
@"abstract class Base
{
protected abstract (int a, int b) Method((string, string d) x);
}
class [|Program|] : Base
{
}"
,
@"using System;
abstract class Base
{
protected abstract (int a, int b) Method((string, string d) x);
}
class Program : Base
{
protected override (int a, int b) Method((string, string d) x)
{
throw new NotImplementedException();
}
}"
);
}
[
WorkItem
(
543234
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543234"
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsImplementAbstractClass
)]
public
async
Task
TestNotAvailableForStruct
()
...
...
src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs
浏览文件 @
1395a762
...
...
@@ -113,6 +113,34 @@ public void Method1()
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsImplementInterface
)]
public
async
Task
TestMethodWithTuple
()
{
await
TestWithAllCodeStyleOptionsOffAsync
(
@"interface IInterface
{
(int, int) Method((string, string) x);
}
class Class : [|IInterface|]
{
}"
,
@"using System;
interface IInterface
{
(int, int) Method((string, string) x);
}
class Class : IInterface
{
public (int, int) Method((string, string) x)
{
throw new NotImplementedException();
}
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsImplementInterface
)]
public
async
Task
TestExpressionBodiedMethod1
()
{
...
...
src/EditorFeatures/VisualBasicTest/Diagnostics/GenerateType/GenerateTypeTests.vb
浏览文件 @
1395a762
...
...
@@ -124,6 +124,46 @@ End Class",
index
:
=
2
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateType
)
>
Public
Async
Function
TestGenerateClassWithCtorFromObjectCreationWithTuple
()
As
Task
Await
TestAsync
(
"Class C
Dim f = New [|Generated|]((1, 2))
End Class"
,
"Class C
Dim f = New Generated((1, 2))
Private Class Generated
Private p As (Integer, Integer)
Public Sub New(p As (Integer, Integer))
Me.p = p
End Sub
End Class
End Class"
,
index
:
=
2
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateType
)
>
Public
Async
Function
TestGenerateClassWithCtorFromObjectCreationWithTupleWithNames
()
As
Task
Await
TestAsync
(
"Class C
Dim f = New [|Generated|]((a:=1, b:=2, 3))
End Class"
,
"Class C
Dim f = New Generated((a:=1, b:=2, 3))
Private Class Generated
Private p As (a As Integer, b As Integer, Integer)
Public Sub New(p As (a As Integer, b As Integer, Integer))
Me.p = p
End Sub
End Class
End Class"
,
index
:
=
2
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsGenerateType
)
>
Public
Async
Function
TestCreateException
()
As
Task
Await
TestAsync
(
...
...
src/EditorFeatures/VisualBasicTest/ImplementAbstractClass/ImplementAbstractClassTests.vb
浏览文件 @
1395a762
...
...
@@ -39,6 +39,27 @@ Public Class Bar
End Class"
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsImplementAbstractClass
)
>
Public
Async
Function
TestMethodWithTupleNames
()
As
Task
Await
TestAsync
(
"Public MustInherit Class Base
Protected MustOverride Function Bar(x As (a As Integer, Integer)) As (c As Integer, Integer)
End Class
Public Class [|Derived|]
Inherits Base
End Class"
,
"Imports System
Public MustInherit Class Base
Protected MustOverride Function Bar(x As (a As Integer, Integer)) As (c As Integer, Integer)
End Class
Public Class Derived
Inherits Base
Protected Overrides Function Bar(x As (a As Integer, Integer)) As (c As Integer, Integer)
Throw New NotImplementedException()
End Function
End Class"
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsImplementAbstractClass
)
>
Public
Async
Function
TestOptionalIntParameter
()
As
Task
Await
TestAsync
(
...
...
src/EditorFeatures/VisualBasicTest/ImplementInterface/ImplementInterfaceTests.vb
浏览文件 @
1395a762
...
...
@@ -35,6 +35,28 @@ Class C
End Class"
)
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsImplementInterface
)
>
Public
Async
Function
TestInterfaceWithTuple
()
As
Task
Await
TestAsync
(
"Imports System
Class Foo
Implements [|IFoo|]
End Class
Interface IFoo
Function Method(x As (Alice As Integer, Bob As Integer)) As (String, String)
End Interface"
,
"Imports System
Class Foo
Implements IFoo
Public Function Method(x As (Alice As Integer, Bob As Integer)) As (String, String) Implements IFoo.Method
Throw New NotImplementedException()
End Function
End Class
Interface IFoo
Function Method(x As (Alice As Integer, Bob As Integer)) As (String, String)
End Interface"
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsImplementInterface
)
>
Public
Async
Function
TestMethodConflict1
()
As
Task
Await
TestAsync
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录