mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Use Stream extension to ensure read operations return the requested number of bytes (unless EOF arrives first).
This commit is contained in:
@@ -31,6 +31,7 @@ namespace Aaru.Tests.Checksums;
|
||||
using System.IO;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Helpers;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
|
||||
@@ -60,7 +61,7 @@ public class Sha512
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "Checksum test files", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.EnsureRead(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha512Context.Data(data, out byte[] result);
|
||||
@@ -82,7 +83,7 @@ public class Sha512
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "Checksum test files", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.EnsureRead(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Sha512Context();
|
||||
@@ -99,7 +100,7 @@ public class Sha512
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "Checksum test files", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.EnsureRead(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
Sha512Context.Data(data, out byte[] result);
|
||||
@@ -121,7 +122,7 @@ public class Sha512
|
||||
var fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "Checksum test files", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.EnsureRead(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Sha512Context();
|
||||
|
||||
Reference in New Issue
Block a user