Exemplo n.º 1
0
 public void GetEntryByName_ReturnsEntry()
 {
     using (Stream stream = File.OpenRead("TestAssets/hfsp.cdr"))
         using (HfsPlusFileSystem hfs = new HfsPlusFileSystem(stream))
         {
             var file = hfs.GetFileInfo("\\hello.txt");
             Assert.Equal(14, file.Length);
         }
 }
Exemplo n.º 2
0
        public void GetUnixFileInfo_ReturnsInfo()
        {
            using (var stream = File.OpenRead("TestAssets/hfsp.cdr"))
                using (var hfs = new HfsPlusFileSystem(stream))
                {
                    var fileInfo = hfs.GetFileInfo("hello.txt");

                    Assert.Equal((FileAttributes)0, fileInfo.Attributes);
                    Assert.True(fileInfo.CreationTimeUtc > new DateTime(2021, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc));
                    Assert.Equal("\\", fileInfo.DirectoryName);
                    Assert.True(fileInfo.Exists);
                    Assert.Equal("txt", fileInfo.Extension);
                    Assert.Same(hfs, fileInfo.FileSystem);
                    Assert.Equal("hello.txt", fileInfo.FullName);
                    Assert.False(fileInfo.IsReadOnly);
                    Assert.True(fileInfo.LastAccessTimeUtc > new DateTime(2021, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc));
                    Assert.True(fileInfo.LastWriteTimeUtc > new DateTime(2021, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc));
                    Assert.Equal(0xe, fileInfo.Length);
                    Assert.Equal("hello.txt", fileInfo.Name);
                    Assert.NotNull(fileInfo.Parent);
                }
        }