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 43285f1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/dotnet_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ jobs:
run: dotnet restore

- name: Build main library
working-directory: src/AvaloniaProjectInfoResolver
working-directory: ./src/AvaloniaProjectInfoResolver
run: dotnet build -c ${{ env.configuration }}

- name: Build tests
working-directory: src/AvaloniaProjectInfoResolver.IntegrationTests
working-directory: ./src/AvaloniaProjectInfoResolver.IntegrationTests
run: dotnet build -c ${{ env.configuration }} -f ${{ matrix.sdk.framework }}

- name: Run tests
working-directory: src/AvaloniaProjectInfoResolver.IntegrationTests
working-directory: ./src/AvaloniaProjectInfoResolver.IntegrationTests
run: dotnet test -c ${{ env.configuration }} -f ${{ matrix.sdk.framework }} --no-build
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 43285f1

Please sign in to comment.