mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-25 00:15:15 +00:00
reader tests don't pass or make sense
This commit is contained in:
45
tests/SharpCompress.Test/Zip/SOZipReaderTests.cs
Normal file
45
tests/SharpCompress.Test/Zip/SOZipReaderTests.cs
Normal file
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ using Xunit;
|
||||
|
||||
namespace SharpCompress.Test.Zip;
|
||||
|
||||
public class SOZipTests : TestBase
|
||||
public class SoZipWriterTests : TestBase
|
||||
{
|
||||
[Fact]
|
||||
public void SOZipIndex_RoundTrip()
|
||||
BIN
tests/TestArchives/Archives/foo.zip
Normal file
BIN
tests/TestArchives/Archives/foo.zip
Normal file
Binary file not shown.
Reference in New Issue
Block a user