示例#1
0
 public void ExpandedName_NotLzFile()
 {
     using (var cleaner = new TestFileCleaner())
     {
         string path = cleaner.CreateTestFile("ExpandedName_NotLzFile");
         CompressionMethods.GetExpandedName(path).Should().Be(path);
     }
 }
示例#2
0
 public void ExpandedName(string compressedName, byte character, string expandedName)
 {
     using (var cleaner = new TestFileCleaner())
     {
         byte[] data = new byte[CompressedFile1.Length];
         CompressedFile1.CopyTo(data, 0);
         data[9] = character;
         string path = Paths.Combine(cleaner.TempFolder, compressedName);
         FileHelper.WriteAllBytes(path, data);
         Path.GetFileName(CompressionMethods.GetExpandedName(path)).Should().Be(expandedName);
     }
 }
示例#3
0
        public void ExpandedName_LongPath()
        {
            // Unfortunately GetExpandedNameW doesn't fail properly. It calls the A version
            // and accidentally ignores the errors returned, copying garbage into the
            // returned string.

            using (var cleaner = new TestFileCleaner())
            {
                string path = PathGenerator.CreatePathOfLength(cleaner.TempFolder, 160);
                FileHelper.WriteAllBytes(path, CompressedFile1);
                Action action = () => CompressionMethods.GetExpandedName(path);
                action.ShouldThrow <LzException>().And.Error.Should().Be(LzError.BadValue);
            }
        }