mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-04 05:25:00 +00:00
Fix more tests
This commit is contained in:
@@ -70,7 +70,7 @@ public class GZipReaderAsyncTests : ReaderTests
|
||||
bufferSize: options.BufferSize
|
||||
);
|
||||
using var testStream = new TestStream(protectedStream);
|
||||
await using (var reader = ReaderFactory.OpenAsync(testStream, options, default))
|
||||
await using (var reader = ReaderFactory.OpenAsync(new AsyncOnlyStream(testStream), options, default))
|
||||
{
|
||||
await UseReaderAsync(reader, expectedCompression);
|
||||
protectedStream.ThrowOnDispose = false;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class TarArchiveAsyncTests : ArchiveTests
|
||||
|
||||
// Step 1: create a tar file containing a file with the test name
|
||||
using (Stream stream = File.OpenWrite(Path.Combine(SCRATCH2_FILES_PATH, archive)))
|
||||
using (var writer = WriterFactory.OpenAsync(stream, ArchiveType.Tar, CompressionType.None))
|
||||
using (var writer = WriterFactory.OpenAsync(new AsyncOnlyStream(stream), ArchiveType.Tar, CompressionType.None))
|
||||
using (Stream inputStream = new MemoryStream())
|
||||
{
|
||||
var sw = new StreamWriter(inputStream);
|
||||
@@ -82,7 +82,7 @@ public class TarArchiveAsyncTests : ArchiveTests
|
||||
|
||||
// Step 1: create a tar file containing a file with a long name
|
||||
using (Stream stream = File.OpenWrite(Path.Combine(SCRATCH2_FILES_PATH, archive)))
|
||||
using (var writer = WriterFactory.OpenAsync(stream, ArchiveType.Tar, CompressionType.None))
|
||||
using (var writer = WriterFactory.OpenAsync(new AsyncOnlyStream(stream), ArchiveType.Tar, CompressionType.None))
|
||||
using (Stream inputStream = new MemoryStream())
|
||||
{
|
||||
var sw = new StreamWriter(inputStream);
|
||||
@@ -183,7 +183,7 @@ public class TarArchiveAsyncTests : ArchiveTests
|
||||
using (var inputMemory = new MemoryStream(mstm.ToArray()))
|
||||
{
|
||||
var tropt = new ReaderOptions { ArchiveEncoding = enc };
|
||||
await using (var tr = ReaderFactory.OpenAsync(inputMemory, tropt))
|
||||
await using (var tr = ReaderFactory.OpenAsync(new AsyncOnlyStream(inputMemory), tropt))
|
||||
{
|
||||
while (await tr.MoveToNextEntryAsync())
|
||||
{
|
||||
|
||||
@@ -73,7 +73,7 @@ public class TarReaderAsyncTests : ReaderTests
|
||||
public async ValueTask Tar_BZip2_Entry_Stream_Async()
|
||||
{
|
||||
using (Stream stream = File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar.bz2")))
|
||||
await using (var reader = ReaderFactory.OpenAsync(stream))
|
||||
await using (var reader = ReaderFactory.OpenAsync(new AsyncOnlyStream(stream)))
|
||||
{
|
||||
while (await reader.MoveToNextEntryAsync())
|
||||
{
|
||||
|
||||
@@ -199,7 +199,7 @@ public class Zip64AsyncTests : WriterTests
|
||||
ZipEntry? prev = null;
|
||||
using (var fs = File.OpenRead(filename))
|
||||
{
|
||||
var rd = ReaderFactory.OpenAsync(fs, new ReaderOptions { LookForHeader = false });
|
||||
var rd = ReaderFactory.OpenAsync(new AsyncOnlyStream(fs), new ReaderOptions { LookForHeader = false });
|
||||
await using (rd)
|
||||
{
|
||||
while (await rd.MoveToNextEntryAsync())
|
||||
|
||||
@@ -9,6 +9,7 @@ using SharpCompress.Common;
|
||||
using SharpCompress.Compressors.Deflate;
|
||||
using SharpCompress.Compressors.Xz;
|
||||
using SharpCompress.Crypto;
|
||||
using SharpCompress.Test.Mocks;
|
||||
using SharpCompress.Writers;
|
||||
using SharpCompress.Writers.Zip;
|
||||
using Xunit;
|
||||
@@ -131,7 +132,7 @@ public class ZipTypesLevelsWithCrcRatioAsyncTests : ArchiveTests
|
||||
CompressionLevel = compressionLevel,
|
||||
};
|
||||
|
||||
using (var writer = WriterFactory.OpenAsync(zipStream, ArchiveType.Zip, writerOptions))
|
||||
using (var writer = WriterFactory.OpenAsync(new AsyncOnlyStream(zipStream), ArchiveType.Zip, writerOptions))
|
||||
{
|
||||
await writer.WriteAsync(
|
||||
$"{compressionType}_level_{compressionLevel}_{sizeMb}MiB.txt",
|
||||
|
||||
Reference in New Issue
Block a user