Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
bd6a5ab1
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,发现更多精彩内容 >>
提交
bd6a5ab1
编写于
1月 24, 2018
作者:
M
Martin Strecker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes for Roslyn.Services.UnitTests
上级
897159db
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
16 deletion
+29
-16
src/Workspaces/CoreTest/WorkspaceTests/MSBuildWorkspaceTests.cs
...rkspaces/CoreTest/WorkspaceTests/MSBuildWorkspaceTests.cs
+29
-16
未找到文件。
src/Workspaces/CoreTest/WorkspaceTests/MSBuildWorkspaceTests.cs
浏览文件 @
bd6a5ab1
...
...
@@ -717,16 +717,18 @@ public void TestOpenProject_WithDuplicateFile()
public
void
TestOpenProject_WithInvalidFileExtension
()
{
// make sure the file does in fact exist, but with an unrecognized extension
const
string
projFileName
=
@"CSharpProject\CSharpProject.csproj.nyi"
;
CreateFiles
(
GetSimpleCSharpSolutionFiles
()
.
WithFile
(
@"CSharpProject\CSharpProject.csproj.nyi"
,
GetResourceText
(
"CSharpProject_CSharpProject.csproj"
)));
.
WithFile
(
projFileName
,
GetResourceText
(
"CSharpProject_CSharpProject.csproj"
)));
AssertThrows
<
InvalidOperationException
>(
delegate
{
MSBuildWorkspace
.
Create
().
OpenProjectAsync
(
GetSolutionFileName
(
@"CSharpProject\CSharpProject.csproj.nyi"
)).
Wait
();
MSBuildWorkspace
.
Create
().
OpenProjectAsync
(
GetSolutionFileName
(
projFileName
)).
Wait
();
},
(
e
)
=>
{
Assert
.
Equal
(
true
,
e
.
Message
.
Contains
(
"extension"
));
var
expected
=
string
.
Format
(
WorkspacesResources
.
Cannot_open_project_0_because_the_file_extension_1_is_not_associated_with_a_language
,
GetSolutionFileName
(
projFileName
),
".nyi"
);
Assert
.
Equal
(
expected
,
e
.
Message
);
});
}
...
...
@@ -734,17 +736,19 @@ public void TestOpenProject_WithInvalidFileExtension()
public
void
TestOpenProject_ProjectFileExtensionAssociatedWithUnknownLanguage
()
{
CreateFiles
(
GetSimpleCSharpSolutionFiles
());
var
projFileName
=
GetSolutionFileName
(
@"CSharpProject\CSharpProject.csproj"
);
var
language
=
"lingo"
;
AssertThrows
<
InvalidOperationException
>(
delegate
{
var
ws
=
MSBuildWorkspace
.
Create
();
ws
.
AssociateFileExtensionWithLanguage
(
"csproj"
,
"lingo"
);
// non-existent language
ws
.
OpenProjectAsync
(
GetSolutionFileName
(
@"CSharpProject\CSharpProject.csproj"
)
).
Wait
();
ws
.
AssociateFileExtensionWithLanguage
(
"csproj"
,
language
);
// non-existent language
ws
.
OpenProjectAsync
(
projFileName
).
Wait
();
},
(
e
)
=>
{
// the exception should tell us something about the language being unrecognized.
Assert
.
Equal
(
true
,
e
.
Message
.
Contains
(
"language"
));
var
expected
=
string
.
Format
(
WorkspacesResources
.
Cannot_open_project_0_because_the_language_1_is_not_supported
,
projFileName
,
language
);
Assert
.
Equal
(
expected
,
e
.
Message
);
});
}
...
...
@@ -1037,9 +1041,10 @@ public void TestOpenSolution_WithUnrecognizedProjectTypeGuidAndUnrecognizedExten
public
void
TestOpenSolution_WithUnrecognizedProjectTypeGuidAndUnrecognizedExtension_WithSkipFalse_Fails
()
{
// proves that if both project type guid and file extension are unrecognized, then open project fails.
const
string
noProjFileName
=
@"CSharpProject\CSharpProject.noproj"
;
CreateFiles
(
GetSimpleCSharpSolutionFiles
()
.
WithFile
(
@"TestSolution.sln"
,
GetResourceText
(
"TestSolution_CSharp_UnknownProjectTypeGuidAndUnknownExtension.sln"
))
.
WithFile
(
@"CSharpProject\CSharpProject.noproj"
,
GetResourceText
(
"CSharpProject_CSharpProject.csproj"
)));
.
WithFile
(
noProjFileName
,
GetResourceText
(
"CSharpProject_CSharpProject.csproj"
)));
AssertThrows
<
InvalidOperationException
>(()
=>
{
...
...
@@ -1049,7 +1054,9 @@ public void TestOpenSolution_WithUnrecognizedProjectTypeGuidAndUnrecognizedExten
},
e
=>
{
Assert
.
Equal
(
true
,
e
.
Message
.
Contains
(
"extension"
));
var
noProjFullFileName
=
GetSolutionFileName
(
noProjFileName
);
var
expected
=
string
.
Format
(
WorkspacesResources
.
Cannot_open_project_0_because_the_file_extension_1_is_not_associated_with_a_language
,
noProjFullFileName
,
".noproj"
);
Assert
.
Equal
(
expected
,
e
.
Message
);
});
}
...
...
@@ -1070,7 +1077,9 @@ public void TestOpenSolution_WithMissingLanguageLibraries_WithSkipFalse_Throws()
},
e
=>
{
Assert
.
Equal
(
true
,
e
.
Message
.
Contains
(
"extension"
));
var
projFileName
=
GetSolutionFileName
(
@"CSharpProject\CSharpProject.csproj"
);
var
expected
=
string
.
Format
(
WorkspacesResources
.
Cannot_open_project_0_because_the_file_extension_1_is_not_associated_with_a_language
,
projFileName
,
".csproj"
);
Assert
.
Equal
(
expected
,
e
.
Message
);
});
}
...
...
@@ -1093,7 +1102,10 @@ public void TestOpenSolution_WithMissingLanguageLibraries_WithSkipTrue_SucceedsW
var
solution
=
ws
.
OpenSolutionAsync
(
GetSolutionFileName
(
@"TestSolution.sln"
)).
Result
;
Assert
.
Equal
(
1
,
dx
.
Count
);
Assert
.
True
(
dx
[
0
].
Message
.
Contains
(
"extension"
));
var
projFileName
=
GetSolutionFileName
(
@"CSharpProject\CSharpProject.csproj"
);
var
expected
=
string
.
Format
(
WorkspacesResources
.
Cannot_open_project_0_because_the_file_extension_1_is_not_associated_with_a_language
,
projFileName
,
".csproj"
);
Assert
.
Equal
(
expected
,
dx
[
0
].
Message
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Workspace
)]
...
...
@@ -1102,15 +1114,16 @@ public void TestOpenProject_WithMissingLanguageLibraries_Throws()
{
// proves that if the language libraries are missing then the appropriate error occurs
CreateFiles
(
GetSimpleCSharpSolutionFiles
());
var
ws
=
MSBuildWorkspace
.
Create
(
_hostServicesWithoutCSharp
);
var
projectName
=
GetSolutionFileName
(
@"CSharpProject\CSharpProject.csproj"
);
AssertThrows
<
InvalidOperationException
>(()
=>
{
var
ws
=
MSBuildWorkspace
.
Create
(
_hostServicesWithoutCSharp
);
var
project
=
ws
.
OpenProjectAsync
(
GetSolutionFileName
(
@"CSharpProject\CSharpProject.csproj"
)).
Result
;
var
project
=
ws
.
OpenProjectAsync
(
projectName
).
Result
;
},
e
=>
{
Assert
.
Equal
(
true
,
e
.
Message
.
Contains
(
"extension"
));
var
expected
=
string
.
Format
(
WorkspacesResources
.
Cannot_open_project_0_because_the_file_extension_1_is_not_associated_with_a_language
,
projectName
,
".csproj"
);
Assert
.
Equal
(
expected
,
e
.
Message
);
});
}
...
...
@@ -2899,7 +2912,7 @@ public void TestAddRemoveMetadataReference_GAC()
Assert
.
Equal
(
false
,
projFileText
.
Contains
(
@"<Reference Include=""System.Xaml,"
));
}
}
[
Fact
(
Skip
=
"https://github.com/dotnet/roslyn/issues/16301"
)]
[
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Workspace
)]
public
void
TestAddRemoveMetadataReference_ReferenceAssembly
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录