public void read_folder() { var fileContents = new FileContent[] { new FileContent("1\test0.json", "testData0"), new FileContent("1\test1.json", "testData1"), new FileContent("1\test2.json", "testData2"), }; var zipArchiveCreater = new ZipArchiveCreater(); foreach (var file in fileContents) { zipArchiveCreater.AddFile(file.Location, file.Content); } var zipStorageEngine = new ZipStorageEngine(zipArchiveCreater.ZipStream); var filesFromZipStorage = zipStorageEngine.ReadDirectory("1").Select(p => p.GetAwaiter().GetResult()).ToArray(); foreach (var file in fileContents) { file.Invoking(f => { var fileForCompare = fileContents.FirstOrDefault(p => p.Location == f.Location); fileForCompare.Should().NotBeNull(); f.Location.Should().Be(fileForCompare.Location); f.Content.Should().Be(fileForCompare.Content); }); zipArchiveCreater.AddFile(file.Location, file.Content); } filesFromZipStorage.Count().Should().Be(3); }
public void read_file() { var zipArchiveCreater = new ZipArchiveCreater(); var fileName = "test.json"; var fileContent = "testData"; zipArchiveCreater.AddFile(fileName, fileContent); var zipStorageEngine = new ZipStorageEngine(zipArchiveCreater.ZipStream); var fileFromZipStorage = zipStorageEngine.ReadFile(fileName).GetAwaiter().GetResult(); fileFromZipStorage.Content.Should().Be(fileContent); }