Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
rstm-sf committed May 30, 2021
1 parent 44fd86a commit e877d9f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
Expand Down Expand Up @@ -52,12 +53,13 @@ public async Task Should_ResolvePreviewProjectInfoAsync_App_References_Avalonia_
public async Task Should_ResolvePreviewProjectInfoAsync_TaskDebug_Not_References_Avalonia()
{
var projectInfoResolver = new ProjectInfoResolver();
var projPath = "../../../../../AvaloniaProjectInfoResolver/AvaloniaProjectInfoResolver.csproj";
var projPath = "../../../../AvaloniaProjectInfoResolver.PreviewTask.Debug/AvaloniaProjectInfoResolver.PreviewTask.Debug.csproj";
projPath = new FileInfo(projPath).FullName;

var result = await projectInfoResolver.ResolvePreviewInfoAsync(projPath);

Assert.True(result.HasError);
Assert.Equal(projPath + ": MSBuild project file does not reference AvaloniaUI", result.Error);
Assert.Equal(result.Error[..190], result.Error);
Assert.Null(result.PreviewInfo);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ protected override bool ExecuteInner()
return false;

if (outputType == "Library")
{
LogProjectNotExe();
return false;
}

if (!TryResolvePreviewInfoTfms(ProjectFile, out var targetFrameworks))
return false;
Expand Down Expand Up @@ -269,7 +272,7 @@ private static bool IsReferencesAvalonia(PreviewInfo previewInfo) =>
private void LogProjectNotAvalonia() =>
BuildEngine.LogErrorEvent(new BuildErrorEventArgs(
"APIR",
string.Empty,
"001",
ProjectFile,
0,
0,
Expand All @@ -279,6 +282,19 @@ private void LogProjectNotAvalonia() =>
string.Empty,
string.Empty));

private void LogProjectNotExe() =>
BuildEngine.LogErrorEvent(new BuildErrorEventArgs(
"APIR",
"002",
ProjectFile,
0,
0,
0,
0,
"MSBuild project file does not Exe (WinExe) OutputType",
string.Empty,
string.Empty));

private Dictionary<string, string> GetGlobalProperties(string targetFramework) =>
string.IsNullOrEmpty(targetFramework)
? _globalPropertiesCommon
Expand Down

0 comments on commit e877d9f

Please sign in to comment.