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 e10f2d2
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 5 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
Expand Up @@ -21,4 +21,9 @@
<ProjectReference Include="..\AvaloniaProjectInfoResolver\AvaloniaProjectInfoResolver.csproj" />
</ItemGroup>

<ItemGroup>
<Content Include="data\ConsoleApp1\ConsoleApp1.fsproj" CopyToOutputDirectory="PreserveNewest" />
<Content Include="data\ConsoleApp1\Program.fs" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

</Project>
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,7 +53,8 @@ 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 = "./data/ConsoleApp1/ConsoleApp1.fsproj";
projPath = new FileInfo(projPath).FullName;

var result = await projectInfoResolver.ResolvePreviewInfoAsync(projPath);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Learn more about F# at http://docs.microsoft.com/dotnet/fsharp

open System

// Define a function to construct a message to print
let from whom =
sprintf "from %s" whom

[<EntryPoint>]
let main argv =
let message = from "F#" // Call the function
printfn "Hello world %s" message
0 // return an integer exit code
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 e10f2d2

Please sign in to comment.