提交 31b3ef25 编写于 作者: T Tomas Matousek

Fix msbuild test

上级 7e4e493b
......@@ -11,7 +11,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Bug2824</RootNamespace>
<AssemblyName>Bug2824</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
......
......@@ -8,6 +8,7 @@
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.UnitTests;
using Microsoft.CodeAnalysis.UnitTests.TestFiles;
using Roslyn.Test.Utilities;
using Xunit;
using static Microsoft.CodeAnalysis.MSBuild.UnitTests.SolutionGeneration;
using CS = Microsoft.CodeAnalysis.CSharp;
......@@ -19,6 +20,11 @@ public class MSBuildWorkspaceTestBase : WorkspaceTestBase
{
protected const string MSBuildNamespace = "http://schemas.microsoft.com/developer/msbuild/2003";
protected void AssertFailures(MSBuildWorkspace workspace, params string[] expectedFailures)
{
AssertEx.Equal(expectedFailures, workspace.Diagnostics.Where(d => d.Kind == WorkspaceDiagnosticKind.Failure).Select(d => d.Message));
}
protected async Task AssertCSCompilationOptionsAsync<T>(T expected, Func<CS.CSharpCompilationOptions, T> actual)
{
var options = await LoadCSharpCompilationOptionsAsync();
......
......@@ -107,8 +107,11 @@ public async Task Test_OpenProjectReferencingPortableProject()
using (var workspace = CreateMSBuildWorkspace())
{
var project = await workspace.OpenProjectAsync(projectFilePath);
AssertFailures(workspace);
var hasFacades = project.MetadataReferences.OfType<PortableExecutableReference>().Any(r => r.FilePath.Contains("Facade"));
Assert.True(hasFacades);
Assert.True(hasFacades, userMessage: "Expected to find facades in the project references:" + Environment.NewLine +
string.Join(Environment.NewLine, project.MetadataReferences.OfType<PortableExecutableReference>().Select(r => r.FilePath)));
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册