LibHac/tests/LibHac.Tests/Fs/IFileSystemTestBase/IFileSystemTests.OpenDirectory.cs

33 lines
906 B
C#
Raw Permalink Normal View History

using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using Xunit;
2021-11-14 20:08:57 +01:00
namespace LibHac.Tests.Fs.IFileSystemTestBase;
public abstract partial class IFileSystemTests
{
2021-11-14 20:08:57 +01:00
[Fact]
public void OpenDirectory_PathIsFile_ReturnsPathNotFound()
{
2021-11-14 20:08:57 +01:00
IFileSystem fs = CreateFileSystem();
2021-11-14 20:08:57 +01:00
fs.CreateFile("/file", 0, CreateFileOptions.None);
2021-11-14 20:08:57 +01:00
using var directory = new UniqueRef<IDirectory>();
Result res = fs.OpenDirectory(ref directory.Ref, "/file", OpenDirectoryMode.All);
Assert.Result(ResultFs.PathNotFound, res);
}
[Fact]
public void OpenDirectory_PathDoesNotExist_ReturnsPathNotFound()
{
IFileSystem fs = CreateFileSystem();
using var directory = new UniqueRef<IDirectory>();
Result res = fs.OpenDirectory(ref directory.Ref, "/dir", OpenDirectoryMode.All);
Assert.Result(ResultFs.PathNotFound, res);
}
}