public void ReadSinglePortion(int fileSize, int portionSize) { var bytes = TC.GetRandomBytes(fileSize); TC.CreateNewTestArchive(bytes); using (var reader = new UncompressedFileReader(TC.TestArchivePath, portionSize)) { var portionBytes = (reader.ReadNextPortion() as MemoryStream).ToArray(); CollectionAssert.AreEqual(bytes, portionBytes); Assert.AreEqual(fileSize, portionBytes.Length); Assert.AreEqual(null, reader.ReadNextPortion()); Assert.AreEqual(null, reader.ReadNextPortion()); Assert.AreEqual(null, reader.ReadNextPortion()); } }
public void ReadFromEmptyFile() { TC.CreateNewTestArchive(); using (var reader = new UncompressedFileReader(TC.TestArchivePath, 100)) { var portion = reader.ReadNextPortion(); Assert.IsNull(portion); } }