Skip to content

Commit

Permalink
Check related path in GetTemporaryDirectory test
Browse files Browse the repository at this point in the history
  • Loading branch information
FrediKats committed Apr 27, 2024
1 parent f3e8727 commit 3790a60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/Kysect.CommonLib.Testing/TestTemporaryDirectory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ public static void DeleteRecursive(IDirectoryInfo target)

private string GetRandomDirectoryName()
{
return Guid.NewGuid().ToString().Substring(8);
return Guid.NewGuid().ToString().Substring(0, 8);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ public class TestTemporaryDirectoryTests
[Fact]
public void GetTemporaryDirectory_ReturnStringDoNotLong()
{
using var temporaryDirectory = new TestTemporaryDirectory(new System.IO.Abstractions.FileSystem());
var fileSystem = new System.IO.Abstractions.FileSystem();
string baseDirectoryPath = fileSystem.Path.GetFullPath(".");
using var temporaryDirectory = new TestTemporaryDirectory(fileSystem);

string directoryPath = temporaryDirectory.GetTemporaryDirectory();
int additionalLength = directoryPath.Length - baseDirectoryPath.Length;

directoryPath.Length.Should().BeLessThan(150);
additionalLength.Should().BeLessThan(25);
}
}

0 comments on commit 3790a60

Please sign in to comment.