Skip to content

Commit

Permalink
Updated test to fail (as expected)
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorFedchenko authored and Aaronontheweb committed Oct 28, 2019
1 parent 53189b8 commit 066d8ca
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using FluentAssertions;
using Incrementalist.Cmd.Commands;
using Incrementalist.ProjectSystem;
using Incrementalist.ProjectSystem.Cmds;
using Incrementalist.Tests.Helpers;
using Microsoft.Build.Locator;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.MSBuild;
using Xunit;
using Xunit.Abstractions;

Expand Down Expand Up @@ -47,15 +51,21 @@ public async Task FSharpProjectDiff_should_be_tracked()
.WriteFile(sample.FSharpProjectFile.Name, sample.FSharpProjectFile.Content + " ")
.Commit("Updated both project files");

var cmd = new FilterAffectedProjectFilesCmd(new TestOutputLogger(_outputHelper), new CancellationToken(), Repository.BasePath, "master");
var solutionFiles = new Dictionary<string, SlnFile>()
{
[solutionFullPath] = new SlnFile(FileType.Solution, ProjectId.CreateNewId()),
[fsharpProjectFullPath] = new SlnFile(FileType.Project, ProjectId.CreateNewId()),
[csharpProjectFullPath] = new SlnFile(FileType.Project, ProjectId.CreateNewId())
};
var filteredAffectedFiles = await cmd.Process(Task.FromResult(solutionFiles));
filteredAffectedFiles.Should().HaveCount(2).And.Subject.Keys.Should().BeEquivalentTo(fsharpProjectFullPath, csharpProjectFullPath);
var logger = new TestOutputLogger(_outputHelper);
var settings = new BuildSettings("master", solutionFullPath, Repository.BasePath);
var workspace = SetupMsBuildWorkspace();
var emitTask = new EmitDependencyGraphTask(settings, workspace, logger);
var affectedFiles = (await emitTask.Run()).ToList();

affectedFiles.Should().HaveCount(2).And.Subject.Should().BeEquivalentTo(fsharpProjectFullPath, csharpProjectFullPath);
}

private static MSBuildWorkspace SetupMsBuildWorkspace()
{
// Locate and register the default instance of MSBuild installed on this machine.
MSBuildLocator.RegisterDefaults();

return MSBuildWorkspace.Create();
}
}
}
1 change: 1 addition & 0 deletions src/Incrementalist.Tests/Incrementalist.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Incrementalist.Cmd\Incrementalist.Cmd.csproj" />
<ProjectReference Include="..\Incrementalist\Incrementalist.csproj" />
</ItemGroup>

Expand Down

0 comments on commit 066d8ca

Please sign in to comment.