mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using System.Threading.Tasks;
|
|
using Xunit;
|
|
|
|
namespace Wabbajack.Common.Test
|
|
{
|
|
public class PathTests
|
|
{
|
|
[Fact]
|
|
public async Task CanDeleteReadOnlyFile()
|
|
{
|
|
var tempFile = new TempFile();
|
|
await tempFile.Path.WriteAllTextAsync("Test");
|
|
tempFile.Path.SetReadOnly(true);
|
|
|
|
tempFile.Path.Delete();
|
|
}
|
|
|
|
[Fact]
|
|
public async Task CanMoveReadOnlyFiles()
|
|
{
|
|
var tempFile = new TempFile();
|
|
var tempFile2 = new TempFile();
|
|
await tempFile.Path.WriteAllTextAsync("Test");
|
|
tempFile.Path.SetReadOnly(true);
|
|
|
|
await tempFile.Path.MoveToAsync(tempFile2.Path);
|
|
}
|
|
|
|
[Fact]
|
|
public void CanGetTopParentOfPath()
|
|
{
|
|
var path = (RelativePath)"foo/bar";
|
|
Assert.Equal((RelativePath)"foo", path.TopParent);
|
|
|
|
}
|
|
|
|
[Fact]
|
|
public void CanGetTopParentOfSinglePath()
|
|
{
|
|
var path = (RelativePath)"foo";
|
|
Assert.Equal((RelativePath)"foo", path.TopParent);
|
|
}
|
|
}
|
|
}
|