Skip to content

Commit

Permalink
Add logging for assets file contents if assertion fails
Browse files Browse the repository at this point in the history
  • Loading branch information
dsplaisted committed May 12, 2020
1 parent 16eaa8f commit 15742b6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Tests/dotnet-restore.Tests/GivenThatIWantToRestoreApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,21 @@ public void ItRestoresLibToSpecificDirectory(bool useStaticGraphEvaluation)
.Pass()
.And.NotHaveStdErr();

var dllCount = 0;

if (Directory.Exists(fullPath))
{
dllCount = Directory.EnumerateFiles(fullPath, "*.dll", SearchOption.AllDirectories).Count();
}

if (dllCount == 0)
{
Log.WriteLine("Assets file contents:");
Log.WriteLine(File.ReadAllText(Path.Combine(rootPath, "obj", "project.assets.json")));
}

Directory.Exists(fullPath).Should().BeTrue();
Directory.EnumerateFiles(fullPath, "*.dll", SearchOption.AllDirectories).Count().Should().BeGreaterThan(0);
dllCount.Should().BeGreaterThan(0);
}

[Theory]
Expand Down

0 comments on commit 15742b6

Please sign in to comment.