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

33 lines
820 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 OpenFile_PathIsDirectory_ReturnsPathNotFound()
{
2021-11-14 20:08:57 +01:00
IFileSystem fs = CreateFileSystem();
2021-11-14 20:08:57 +01:00
fs.CreateDirectory("/dir");
2021-11-14 20:08:57 +01:00
using var file = new UniqueRef<IFile>();
Result res = fs.OpenFile(ref file.Ref, "/dir", OpenMode.All);
Assert.Result(ResultFs.PathNotFound, res);
}
[Fact]
public void OpenFile_PathDoesNotExist_ReturnsPathNotFound()
{
IFileSystem fs = CreateFileSystem();
using var file = new UniqueRef<IFile>();
Result res = fs.OpenFile(ref file.Ref, "/file", OpenMode.All);
Assert.Result(ResultFs.PathNotFound, res);
}
}