diff --git a/tests/SharpCompress.Test/Zip/SOZipReaderTests.cs b/tests/SharpCompress.Test/Zip/SOZipReaderTests.cs new file mode 100644 index 00000000..9c6fa089 --- /dev/null +++ b/tests/SharpCompress.Test/Zip/SOZipReaderTests.cs @@ -0,0 +1,45 @@ +using System; +using System.IO; +using System.Threading.Tasks; +using SharpCompress.Archives.Zip; +using SharpCompress.Common.Zip.SOZip; +using SharpCompress.Readers; +using SharpCompress.Readers.Zip; +using SharpCompress.Test.Mocks; +using Xunit; + +namespace SharpCompress.Test.Zip; + +public class SoZipReaderTests : TestBase +{ + [Fact] + public async Task SOZip_Reader() + { + var path = Path.Combine(TEST_ARCHIVES_PATH, "foo.zip"); + using Stream stream = new ForwardOnlyStream(File.OpenRead(path)); + using var reader = ZipReader.Open(stream); + while (await reader.MoveToNextEntryAsync()) + { + Assert.True(reader.Entry.IsSozip, $"Entry {reader.Entry.Key} is not SOZip"); + if (!reader.Entry.IsDirectory) + { + await reader.WriteEntryToAsync(Stream.Null); + } + } + } + + [Fact] + public void SOZip_Archive() + { + var path = Path.Combine(TEST_ARCHIVES_PATH, "foo.zip"); + using Stream stream = File.OpenRead(path); + using var archive = ZipArchive.Open(stream); + foreach (var entry in archive.Entries) + { + if (entry.IsSozip) + Console.WriteLine($"{entry.Key} has SOZip random access support"); + if (entry.IsSozipIndexFile) + Console.WriteLine($"{entry.Key} is a SOZip index file"); + } + } +} diff --git a/tests/SharpCompress.Test/Zip/SOZipTests.cs b/tests/SharpCompress.Test/Zip/SoZipWriterTests.cs similarity index 99% rename from tests/SharpCompress.Test/Zip/SOZipTests.cs rename to tests/SharpCompress.Test/Zip/SoZipWriterTests.cs index 33b71dc2..dde04a92 100644 --- a/tests/SharpCompress.Test/Zip/SOZipTests.cs +++ b/tests/SharpCompress.Test/Zip/SoZipWriterTests.cs @@ -11,7 +11,7 @@ using Xunit; namespace SharpCompress.Test.Zip; -public class SOZipTests : TestBase +public class SoZipWriterTests : TestBase { [Fact] public void SOZipIndex_RoundTrip() diff --git a/tests/TestArchives/Archives/foo.zip b/tests/TestArchives/Archives/foo.zip new file mode 100644 index 00000000..fb80a922 Binary files /dev/null and b/tests/TestArchives/Archives/foo.zip differ