Skip to content

Commit 00ee653

Browse files
authored
Merge PR #466: Improve the ZipFileStoreAesPartialRead test to test multiple block sizes
1 parent 4d8c4a9 commit 00ee653

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

test/ICSharpCode.SharpZipLib.Tests/Zip/ZipEncryptionHandling.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public void ZipFileStoreAes()
150150
[Test]
151151
[Category("Encryption")]
152152
[Category("Zip")]
153-
public void ZipFileStoreAesPartialRead()
153+
public void ZipFileStoreAesPartialRead([Values(1, 7, 17)] int readSize)
154154
{
155155
string password = "password";
156156

@@ -179,16 +179,16 @@ public void ZipFileStoreAesPartialRead()
179179
{
180180
using (var zis = zipFile.GetInputStream(entry))
181181
{
182-
byte[] buffer = new byte[1];
182+
byte[] buffer = new byte[readSize];
183183

184184
while (true)
185185
{
186-
int b = zis.ReadByte();
186+
int read = zis.Read(buffer, 0, readSize);
187187

188-
if (b == -1)
188+
if (read == 0)
189189
break;
190190

191-
ms.WriteByte((byte)b);
191+
ms.Write(buffer, 0, read);
192192
}
193193
}
194194

0 commit comments

Comments
 (0)