public void TestGetStream_ArchiveHasFile() { using (ShimsContext.Create()) { var memoryStream = new MemoryStream(); var sevisId = "N000012345"; var now = DateTime.UtcNow; var zipFileName = String.Format("_{0}_{1}.pdf", sevisId, now); var entry = new System.IO.Compression.Fakes.ShimZipArchiveEntry { NameGet = () => zipFileName, Open = () => memoryStream }; var entries = new List <ZipArchiveEntry>(); entries.Add(entry); var readonlyEntries = new ReadOnlyCollection <ZipArchiveEntry>(entries); var zipArchive = new System.IO.Compression.Fakes.ShimZipArchive { EntriesGet = () => readonlyEntries }; var archiveHandler = new SevisBatchZipArchiveHandler(zipArchive); Assert.IsTrue(Object.ReferenceEquals(memoryStream, archiveHandler.GetStream(sevisId))); memoryStream.Dispose(); } }
public void TestGetStream_ArchiveDoesNotHaveFile() { using (ShimsContext.Create()) { var sevisId = "N000012345"; var entries = new List <ZipArchiveEntry>(); var readonlyEntries = new ReadOnlyCollection <ZipArchiveEntry>(entries); var zipArchive = new System.IO.Compression.Fakes.ShimZipArchive { EntriesGet = () => readonlyEntries }; var archiveHandler = new SevisBatchZipArchiveHandler(zipArchive); Assert.IsNull(archiveHandler.GetStream(sevisId)); } }