Skip to content

Commit

Permalink
Rename DisposableTempDirectory.DirectoryPath to Path
Browse files Browse the repository at this point in the history
  • Loading branch information
adamreeve committed Jul 7, 2024
1 parent 4f1c9d2 commit 2656c39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ public class DirectoryRepositoryResolverTests
public void CanLoadRepositoryFromDirectory()
{
using var directory = new DisposableTempDirectory();
var filePath = Path.Join(directory.DirectoryPath, "GObject-2.0.gir");
var filePath = Path.Join(directory.Path, "GObject-2.0.gir");
File.WriteAllText(filePath, InputRepositoryHelper.CreateXml("GObject", "2.0"));

var resolver = new DirectoryRepositoryResolver(directory.DirectoryPath);
var resolver = new DirectoryRepositoryResolver(directory.Path);

var repository = resolver.ResolveRepository("GObject-2.0.gir");

Expand All @@ -25,7 +25,7 @@ public void CanLoadRepositoryFromDirectory()
public void ReturnsNullWhenFileNotFound()
{
using var directory = new DisposableTempDirectory();
var resolver = new DirectoryRepositoryResolver(directory.DirectoryPath);
var resolver = new DirectoryRepositoryResolver(directory.Path);

var repository = resolver.ResolveRepository("GObject-2.0.gir");

Expand Down
11 changes: 5 additions & 6 deletions src/Tests/Generation/GirLoader.Tests/DisposableTempDirectory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@ namespace GirLoader.Test;

public class DisposableTempDirectory : IDisposable
{
private readonly string _directoryPath;

public DisposableTempDirectory()
{
_directoryPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
Directory.CreateDirectory(_directoryPath);
Path = System.IO.Path.Combine(
System.IO.Path.GetTempPath(), System.IO.Path.GetRandomFileName());
Directory.CreateDirectory(Path);
}

public string DirectoryPath => _directoryPath;
public string Path { get; }

public void Dispose()
{
Directory.Delete(_directoryPath, recursive: true);
Directory.Delete(Path, recursive: true);
}
}

0 comments on commit 2656c39

Please sign in to comment.