Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
9119afc4
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,发现更多精彩内容 >>
提交
9119afc4
编写于
2月 27, 2017
作者:
J
Jonathon Marolf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
responding to PR feedback
上级
b1702195
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
56 addition
and
64 deletion
+56
-64
src/VisualStudio/IntegrationTest/IntegrationTests/AbstractEditorTest.cs
...io/IntegrationTest/IntegrationTests/AbstractEditorTest.cs
+12
-27
src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpWinForms.cs
...IntegrationTest/IntegrationTests/CSharp/CSharpWinForms.cs
+38
-32
src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs
.../IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs
+2
-1
src/VisualStudio/IntegrationTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs
...onTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs
+3
-3
src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/SolutionExplorer_OutOfProc.cs
.../TestUtilities/OutOfProcess/SolutionExplorer_OutOfProc.cs
+1
-1
未找到文件。
src/VisualStudio/IntegrationTest/IntegrationTests/AbstractEditorTest.cs
浏览文件 @
9119afc4
...
...
@@ -86,43 +86,28 @@ protected void CloseFile(string projectName, string fileName, bool saveFile = tr
protected
void
SaveFile
(
string
projectName
,
string
fileName
)
=>
VisualStudio
.
Instance
.
SolutionExplorer
.
SaveFile
(
projectName
,
fileName
);
protected
void
AddWinFormButton
(
string
projectName
,
string
fileName
,
string
buttonName
)
{
OpenFileWithDesigner
(
projectName
,
fileName
);
VisualStudio
.
Instance
.
Editor
.
AddWinFormButton
(
buttonName
);
}
protected
void
AddWinFormButton
(
string
buttonName
)
=>
VisualStudio
.
Instance
.
Editor
.
AddWinFormButton
(
buttonName
);
protected
void
DeleteWinFormButton
(
string
projectName
,
string
fileName
,
string
buttonName
)
{
OpenFileWithDesigner
(
projectName
,
fileName
);
VisualStudio
.
Instance
.
Editor
.
DeleteWinFormButton
(
buttonName
);
}
protected
void
DeleteWinFormButton
(
string
buttonName
)
=>
VisualStudio
.
Instance
.
Editor
.
DeleteWinFormButton
(
buttonName
);
protected
void
EditWinFormButtonProperty
(
string
projectName
,
string
fileName
,
string
buttonName
,
string
propertyName
,
string
propertyValue
,
string
propertyTypeName
=
null
)
{
OpenFileWithDesigner
(
projectName
,
fileName
);
VisualStudio
.
Instance
.
Editor
.
EditWinFormButtonProperty
(
buttonName
,
propertyName
,
propertyValue
,
propertyTypeName
);
}
protected
void
EditWinFormButtonProperty
(
string
buttonName
,
string
propertyName
,
string
propertyValue
,
string
propertyTypeName
=
null
)
=>
VisualStudio
.
Instance
.
Editor
.
EditWinFormButtonProperty
(
buttonName
,
propertyName
,
propertyValue
,
propertyTypeName
);
protected
void
EditWinFormsButtonEvent
(
string
projectName
,
string
fileName
,
string
buttonName
,
string
eventName
,
string
eventHandlerName
)
{
OpenFileWithDesigner
(
projectName
,
fileName
);
VisualStudio
.
Instance
.
Editor
.
EditWinFormButtonEvent
(
buttonName
,
eventName
,
eventHandlerName
);
}
protected
void
EditWinFormsButtonEvent
(
string
buttonName
,
string
eventName
,
string
eventHandlerName
)
=>
VisualStudio
.
Instance
.
Editor
.
EditWinFormButtonEvent
(
buttonName
,
eventName
,
eventHandlerName
);
protected
void
VerifyWinFormButtonPropertySet
(
string
projectName
,
string
fileName
,
string
buttonName
,
string
propertyName
,
string
expectedPropertyValue
)
{
OpenFileWithDesigner
(
projectName
,
fileName
);
VisualStudio
.
Instance
.
Editor
.
VerifyWinFormButtonPropertySet
(
buttonName
,
propertyName
,
expectedPropertyValue
);
}
protected
void
VerifyWinFormButtonPropertySet
(
string
buttonName
,
string
propertyName
,
string
expectedPropertyValue
)
=>
VisualStudio
.
Instance
.
Editor
.
VerifyWinFormButtonPropertySet
(
buttonName
,
propertyName
,
expectedPropertyValue
);
protected
void
SelectTextInCurrentDocument
(
string
text
)
{
VisualStudio
.
Instance
.
Editor
.
PlaceCaret
(
text
,
charsOffset
:
-
1
,
occurrence
:
0
,
extendSelection
:
tru
e
,
selectBlock
:
false
);
VisualStudio
.
Instance
.
Editor
.
PlaceCaret
(
text
,
charsOffset
:
-
1
,
occurrence
:
0
,
extendSelection
:
fals
e
,
selectBlock
:
false
);
VisualStudio
.
Instance
.
Editor
.
PlaceCaret
(
text
,
charsOffset
:
0
,
occurrence
:
0
,
extendSelection
:
true
,
selectBlock
:
false
);
}
protected
void
BuildSolution
(
bool
waitForBuildToFinish
=
false
)
protected
void
BuildSolution
(
bool
waitForBuildToFinish
)
=>
VisualStudio
.
Instance
.
SolutionExplorer
.
BuildSolution
(
waitForBuildToFinish
);
protected
int
GetErrorListErrorCount
()
...
...
src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpWinForms.cs
浏览文件 @
9119afc4
...
...
@@ -24,8 +24,9 @@ public CSharpWinForms(VisualStudioInstanceFactory instanceFactory)
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
WinForms
)]
public
void
Add_Control
()
{
AddWinFormButton
(
ProjectName
,
"Form1.cs"
,
"SomeButton"
);
CloseFile
(
ProjectName
,
"Form1.cs"
,
saveFile
:
true
);
OpenFileWithDesigner
(
ProjectName
,
"Form1.cs"
);
AddWinFormButton
(
"SomeButton"
);
SaveFile
(
ProjectName
,
"Form1.cs"
);
OpenFile
(
ProjectName
,
"Form1.Designer.cs"
);
VerifyTextContains
(
@"this.SomeButton.Name = ""SomeButton"""
);
VerifyTextContains
(
@"private System.Windows.Forms.Button SomeButton;"
);
...
...
@@ -34,8 +35,9 @@ public void Add_Control()
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
WinForms
)]
public
void
Change_Control_Property
()
{
AddWinFormButton
(
ProjectName
,
"Form1.cs"
,
"SomeButton"
);
EditWinFormButtonProperty
(
ProjectName
,
"Form1.cs"
,
buttonName
:
"SomeButton"
,
propertyName
:
"Text"
,
propertyValue
:
"NewButtonText"
);
OpenFileWithDesigner
(
ProjectName
,
"Form1.cs"
);
AddWinFormButton
(
"SomeButton"
);
EditWinFormButtonProperty
(
buttonName
:
"SomeButton"
,
propertyName
:
"Text"
,
propertyValue
:
"NewButtonText"
);
CloseFile
(
ProjectName
,
"Form1.cs"
,
saveFile
:
true
);
OpenFile
(
ProjectName
,
"Form1.Designer.cs"
);
VerifyTextContains
(
@"this.SomeButton.Text = ""NewButtonText"""
);
...
...
@@ -44,9 +46,10 @@ public void Change_Control_Property()
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
WinForms
)]
public
void
Change_Control_Property_In_Code
()
{
AddWinFormButton
(
ProjectName
,
"Form1.cs"
,
"SomeButton"
);
EditWinFormButtonProperty
(
ProjectName
,
"Form1.cs"
,
buttonName
:
"SomeButton"
,
propertyName
:
"Text"
,
propertyValue
:
"ButtonTextGoesHere"
);
VerifyWinFormButtonPropertySet
(
ProjectName
,
"Form1.cs"
,
buttonName
:
"SomeButton"
,
propertyName
:
"Text"
,
expectedPropertyValue
:
"ButtonTextGoesHere"
);
OpenFileWithDesigner
(
ProjectName
,
"Form1.cs"
);
AddWinFormButton
(
"SomeButton"
);
EditWinFormButtonProperty
(
buttonName
:
"SomeButton"
,
propertyName
:
"Text"
,
propertyValue
:
"ButtonTextGoesHere"
);
VerifyWinFormButtonPropertySet
(
buttonName
:
"SomeButton"
,
propertyName
:
"Text"
,
expectedPropertyValue
:
"ButtonTextGoesHere"
);
CloseFile
(
ProjectName
,
"Form1.cs"
,
saveFile
:
true
);
// Change the control's text in designer.cs code
OpenFile
(
ProjectName
,
"Form1.Designer.cs"
);
...
...
@@ -58,14 +61,15 @@ public void Change_Control_Property_In_Code()
CloseFile
(
ProjectName
,
"Form1.Designer.cs"
,
saveFile
:
true
);
// Verify that the control text has changed in the designer
OpenFileWithDesigner
(
ProjectName
,
"Form1.cs"
);
VerifyWinFormButtonPropertySet
(
ProjectName
,
"Form1.cs"
,
buttonName
:
"SomeButton"
,
propertyName
:
"Text"
,
expectedPropertyValue
:
"GibberishText"
);
VerifyWinFormButtonPropertySet
(
buttonName
:
"SomeButton"
,
propertyName
:
"Text"
,
expectedPropertyValue
:
"GibberishText"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
WinForms
)]
public
void
Add_Click_Handler
()
{
AddWinFormButton
(
ProjectName
,
"Form1.cs"
,
"SomeButton"
);
EditWinFormsButtonEvent
(
ProjectName
,
"Form1.cs"
,
buttonName
:
"SomeButton"
,
eventName
:
"Click"
,
eventHandlerName
:
"ExecuteWhenButtonClicked"
);
OpenFileWithDesigner
(
ProjectName
,
"Form1.cs"
);
AddWinFormButton
(
"SomeButton"
);
EditWinFormsButtonEvent
(
buttonName
:
"SomeButton"
,
eventName
:
"Click"
,
eventHandlerName
:
"ExecuteWhenButtonClicked"
);
OpenFile
(
ProjectName
,
"Form1.Designer.cs"
);
VerifyTextContains
(
@"this.SomeButton.Click += new System.EventHandler(this.ExecuteWhenButtonClicked);"
);
OpenFile
(
ProjectName
,
"Form1.cs"
);
...
...
@@ -86,12 +90,13 @@ private void ExecuteWhenButtonClicked(object sender, EventArgs e)
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
WinForms
)]
public
void
Rename_Control
()
{
AddWinFormButton
(
ProjectName
,
"Form1.cs"
,
"SomeButton"
);
OpenFileWithDesigner
(
ProjectName
,
"Form1.cs"
);
AddWinFormButton
(
"SomeButton"
);
// Add some control properties and events
EditWinFormButtonProperty
(
ProjectName
,
"Form1.cs"
,
buttonName
:
"SomeButton"
,
propertyName
:
"Text"
,
propertyValue
:
"ButtonTextValue"
);
EditWinFormsButtonEvent
(
ProjectName
,
"Form1.cs"
,
buttonName
:
"SomeButton"
,
eventName
:
"Click"
,
eventHandlerName
:
"SomeButtonHandler"
);
EditWinFormButtonProperty
(
buttonName
:
"SomeButton"
,
propertyName
:
"Text"
,
propertyValue
:
"ButtonTextValue"
);
EditWinFormsButtonEvent
(
buttonName
:
"SomeButton"
,
eventName
:
"Click"
,
eventHandlerName
:
"SomeButtonHandler"
);
// Rename the control
EditWinFormButtonProperty
(
ProjectName
,
"Form1.cs"
,
buttonName
:
"SomeButton"
,
propertyName
:
"Name"
,
propertyValue
:
"SomeNewButton"
);
EditWinFormButtonProperty
(
buttonName
:
"SomeButton"
,
propertyName
:
"Name"
,
propertyValue
:
"SomeNewButton"
);
VerifyNoBuildErrors
();
// Verify that the rename propagated in designer code
OpenFile
(
ProjectName
,
"Form1.Designer.cs"
);
...
...
@@ -106,10 +111,11 @@ public void Rename_Control()
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
WinForms
)]
public
void
Remove_Event_Handler
()
{
AddWinFormButton
(
ProjectName
,
"Form1.cs"
,
"SomeButton"
);
EditWinFormsButtonEvent
(
ProjectName
,
"Form1.cs"
,
buttonName
:
"SomeButton"
,
eventName
:
"Click"
,
eventHandlerName
:
"FooHandler"
);
OpenFileWithDesigner
(
ProjectName
,
"Form1.cs"
);
AddWinFormButton
(
"SomeButton"
);
EditWinFormsButtonEvent
(
buttonName
:
"SomeButton"
,
eventName
:
"Click"
,
eventHandlerName
:
"FooHandler"
);
// Remove the event handler
EditWinFormsButtonEvent
(
ProjectName
,
"Form1.cs"
,
buttonName
:
"SomeButton"
,
eventName
:
"Click"
,
eventHandlerName
:
""
);
EditWinFormsButtonEvent
(
buttonName
:
"SomeButton"
,
eventName
:
"Click"
,
eventHandlerName
:
""
);
VerifyNoBuildErrors
();
// Verify that the handler is removed
OpenFile
(
ProjectName
,
"Form1.Designer.cs"
);
...
...
@@ -119,10 +125,9 @@ public void Remove_Event_Handler()
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
WinForms
)]
public
void
Change_Accessibility
()
{
AddWinFormButton
(
ProjectName
,
"Form1.cs"
,
"SomeButton"
);
EditWinFormButtonProperty
(
ProjectName
,
"Form1.cs"
,
buttonName
:
"SomeButton"
,
propertyName
:
"Modifiers"
,
OpenFileWithDesigner
(
ProjectName
,
"Form1.cs"
);
AddWinFormButton
(
"SomeButton"
);
EditWinFormButtonProperty
(
buttonName
:
"SomeButton"
,
propertyName
:
"Modifiers"
,
propertyTypeName
:
"System.CodeDom.MemberAttributes"
,
propertyValue
:
"Public"
);
VerifyNoBuildErrors
();
...
...
@@ -133,8 +138,9 @@ public void Change_Accessibility()
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
WinForms
)]
public
void
Delete_Control
()
{
AddWinFormButton
(
ProjectName
,
"Form1.cs"
,
"SomeButton"
);
DeleteWinFormButton
(
ProjectName
,
"Form1.cs"
,
"SomeButton"
);
OpenFileWithDesigner
(
ProjectName
,
"Form1.cs"
);
AddWinFormButton
(
"SomeButton"
);
DeleteWinFormButton
(
"SomeButton"
);
VerifyNoBuildErrors
();
OpenFile
(
ProjectName
,
"Form1.Designer.cs"
);
VerifyTextDoesNotContain
(
@"this.SomeButton.Name = ""SomeButton"";"
);
...
...
src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs
浏览文件 @
9119afc4
...
...
@@ -155,9 +155,10 @@ public void PlaceCaret(string marker, int charsOffset, int occurrence, bool exte
dte
.
Find
.
Action
=
EnvDTE
.
vsFindAction
.
vsFindActionFind
;
var
originalPosition
=
GetCaretPosition
();
view
.
Caret
.
MoveTo
(
new
Microsoft
.
VisualStudio
.
Text
.
SnapshotPoint
(
view
.
GetBufferContainingCaret
().
CurrentSnapshot
,
0
));
if
(
occurrence
>
0
)
{
view
.
Caret
.
MoveTo
(
new
Microsoft
.
VisualStudio
.
Text
.
SnapshotPoint
(
view
.
GetBufferContainingCaret
().
CurrentSnapshot
,
0
));
var
result
=
EnvDTE
.
vsFindResult
.
vsFindResultNotFound
;
for
(
var
i
=
0
;
i
<
occurrence
;
i
++)
...
...
src/VisualStudio/IntegrationTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs
浏览文件 @
9119afc4
...
...
@@ -359,7 +359,7 @@ private static void SaveFile(string fileName)
if
(
fileToSave
==
null
)
{
var
fileNames
=
dte
.
Documents
.
Cast
<
EnvDTE
.
Document
>().
Select
(
d
=>
d
.
Name
);
throw
new
Exception
(
$"File '
{
fileName
}
' not saved because it couldn't be found. Available files:
{
string
.
Join
(
", "
,
fileNames
)}
."
);
throw
new
InvalidOperation
Exception
(
$"File '
{
fileName
}
' not saved because it couldn't be found. Available files:
{
string
.
Join
(
", "
,
fileNames
)}
."
);
}
var
textDocument
=
(
EnvDTE
.
TextDocument
)
fileToSave
.
Object
(
nameof
(
EnvDTE
.
TextDocument
));
var
currentTextInDocument
=
textDocument
.
StartPoint
.
CreateEditPoint
().
GetText
(
textDocument
.
EndPoint
);
...
...
@@ -367,7 +367,7 @@ private static void SaveFile(string fileName)
fileToSave
.
Save
();
if
(
File
.
ReadAllText
(
fullPath
)
!=
currentTextInDocument
)
{
throw
new
Exception
(
"The text that we thought we were saving isn't what we saved!"
);
throw
new
InvalidOperation
Exception
(
"The text that we thought we were saving isn't what we saved!"
);
}
}
...
...
src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/SolutionExplorer_OutOfProc.cs
浏览文件 @
9119afc4
...
...
@@ -44,7 +44,7 @@ public void SetFileContents(string projectName, string fileName, string contents
public
string
GetFileContents
(
string
projectName
,
string
fileName
)
=>
_inProc
.
GetFileContents
(
projectName
,
fileName
);
public
void
BuildSolution
(
bool
waitForBuildToFinish
=
false
)
public
void
BuildSolution
(
bool
waitForBuildToFinish
)
=>
_inProc
.
BuildSolution
(
waitForBuildToFinish
);
public
void
OpenFileWithDesigner
(
string
projectName
,
string
fileName
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录