Skip to content

Commit

Permalink
Fix the paths
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed Jul 23, 2024
1 parent d5fb1af commit 40c4e35
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/SingleProject/Resizetizer/test/UnitTests/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ void AssertFileMatchesReal(string actualFilename, object[] args = null, [CallerM

if (!isSimilar)
{
var root = GetThisFilePath();
root = Path.GetDirectoryName(root);
var root = GetTestProjectRoot();
var filename = GetTestImageFileName(args, methodName);

var maskFilename = Path.Combine(root, "errors", filename);
Expand All @@ -161,9 +160,7 @@ void AssertFileMatchesReal(string actualFilename, object[] args = null, [CallerM

void SaveImageResultFileReal(string destinationFilename, object[] args = null, [CallerMemberName] string methodName = null)
{
var root = GetThisFilePath();
root = Path.GetDirectoryName(root);

var root = GetTestProjectRoot();
var imagePath = GetTestImageFileName(args, methodName);
var path = Path.Combine(root, imagePath);

Expand Down Expand Up @@ -198,6 +195,13 @@ private string GetTestImageFileName(object[] args, string methodName)
return Path.Combine(TestImagesFolderName, name, methodName, filename);
}

private static string GetThisFilePath([CallerFilePath] string path = null) => path;
private static string GetTestProjectRoot()
{
var cwd = Directory.GetCurrentDirectory();

var root = Path.Combine(cwd, "../../../../../src/SingleProject/Resizetizer/test/UnitTests/");

return root;
}
}
}

0 comments on commit 40c4e35

Please sign in to comment.