public void ExpandedName_NotLzFile() { using (var cleaner = new TestFileCleaner()) { string path = cleaner.CreateTestFile("ExpandedName_NotLzFile"); CompressionMethods.GetExpandedName(path).Should().Be(path); } }
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); } }
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); } }