protected async Task CreateZipFromFileContentListCore() { string methodName = GetTempDirectory(); string dummyFileZip = "dummyZip.zip"; string dummyFolderPath = Utils.CreateDummyDirectory(_mockData.ResourceFolder, methodName, cleanFolder: true); string dummyFileZipPath = Path.Combine(dummyFolderPath, dummyFileZip); List <string> files = new List <string> { Path.Combine(dummyFolderPath, "dummy1.txt"), Path.Combine(dummyFolderPath, "dummy2.txt"), Path.Combine(dummyFolderPath, "dummy3.txt") }; files.ForEach(file => Utils.CreateDummyFile(dummyFolderPath, Path.GetFileName(file), cleanFolder: false)); Zipper.CreateZipFileFromFileListWithFileNameOnly(dummyFileZipPath, files); byte[] bytesOfZip = await KFile.ReadAllBytesAsync(dummyFileZipPath); IList <Core.Support.Pair <string, byte[]> > actualUnzippedFiles = UnZipper.GetFileContentsFromZipFile(bytesOfZip); byte[] bytesOfZipFile = Zipper.CreateZipFromFileContentList(actualUnzippedFiles); IList <Core.Support.Pair <string, byte[]> > expectedUnzippedFiles = UnZipper.GetFileContentsFromZipFile(dummyFileZipPath); Assert.True(expectedUnzippedFiles.Count == actualUnzippedFiles.Count); Utils.RemoveDir(dummyFolderPath); }
protected void CreateZipFileFromFileListWithFileNameOnlyCore() { string tempDir = GetTempDirectory(); string dummyFileZip = "dummy.zip"; string dummyFolderPath = Utils.CreateDummyDirectory(_mockData.ResourceFolder, tempDir, cleanFolder: true); string dummyFileZipPath = Path.Combine(dummyFolderPath, dummyFileZip); List <string> files = new List <string> { Path.Combine(dummyFolderPath, "dummy1.txt"), Path.Combine(dummyFolderPath, "dummy2.txt"), Path.Combine(dummyFolderPath, "dummy3.txt") }; files.ForEach(file => Utils.CreateDummyFile(dummyFolderPath, Path.GetFileName(file), cleanFolder: false)); Zipper.CreateZipFileFromFileListWithFileNameOnly(dummyFileZipPath, files); IList <Pair <string, byte[]> > fileContents = UnZipper.GetFileContentsFromZipFile(dummyFileZipPath); Assert.Equal(fileContents.Count, files.Count); Utils.RemoveDir(dummyFolderPath); }