Ejemplo n.º 1
0
        public void ExtractionIntoFolder()
        {
            using (var extractor = Extractor.FromStream(new MemoryStream(_archiveData), _sandbox, Model.Archive.MimeTypeZip))
                extractor.Run();

            Assert.IsTrue(Directory.Exists(_sandbox));
            var comparer = new CompareHierarchyToExtractedFolder(_sandbox);
            _package.AcceptVisitor(comparer);
        }
Ejemplo n.º 2
0
        public void ExtractionIntoFolder()
        {
            using (var extractor = Extractor.FromStream(new MemoryStream(_archiveData), _sandbox, Model.Archive.MimeTypeZip))
                extractor.Run();

            Assert.IsTrue(Directory.Exists(_sandbox));
            var comparer = new CompareHierarchyToExtractedFolder(_sandbox);

            _package.AcceptVisitor(comparer);
        }
Ejemplo n.º 3
0
        public void ExtractionIntoFolder()
        {
            using (var extractor = ArchiveExtractor.Create(new MemoryStream(_archiveData), _sandbox, Archive.MimeTypeZip))
                extractor.Run();

            Directory.Exists(_sandbox).Should().BeTrue();
            var comparer = new CompareHierarchyToExtractedFolder(_sandbox);

            _package.AcceptVisitor(comparer);
        }
Ejemplo n.º 4
0
        public void TestExtractOverwritingExistingItems()
        {
            File.WriteAllText(Path.Combine(_sandbox, "file1"), @"Wrong content");
            File.WriteAllText(Path.Combine(_sandbox, "file0"), @"This file should not be touched");

            using (var extractor = Extractor.FromStream(new MemoryStream(_archiveData), _sandbox, Model.Archive.MimeTypeZip))
                extractor.Run();

            Assert.IsTrue(File.Exists(Path.Combine(_sandbox, "file0")), "Extractor cleaned directory.");
            string file0Content = File.ReadAllText(Path.Combine(_sandbox, "file0"));

            Assert.AreEqual("This file should not be touched", file0Content);
            var comparer = new CompareHierarchyToExtractedFolder(_sandbox);

            _package.AcceptVisitor(comparer);
        }
Ejemplo n.º 5
0
        public void TestExtractOverwritingExistingItems()
        {
            File.WriteAllText(Path.Combine(_sandbox, "file1"), @"Wrong content");
            File.WriteAllText(Path.Combine(_sandbox, "file0"), @"This file should not be touched");

            using (var extractor = ArchiveExtractor.Create(new MemoryStream(_archiveData), _sandbox, Archive.MimeTypeZip))
                extractor.Run();

            File.Exists(Path.Combine(_sandbox, "file0")).Should().BeTrue(because: "Extractor cleaned directory.");
            string file0Content = File.ReadAllText(Path.Combine(_sandbox, "file0"));

            file0Content.Should().Be("This file should not be touched");
            var comparer = new CompareHierarchyToExtractedFolder(_sandbox);

            _package.AcceptVisitor(comparer);
        }
Ejemplo n.º 6
0
        public void ExtractionIntoFolder()
        {
            using (var extractor = ArchiveExtractor.Create(new MemoryStream(_archiveData), _sandbox, Archive.MimeTypeZip))
                extractor.Run();

            Directory.Exists(_sandbox).Should().BeTrue();
            var comparer = new CompareHierarchyToExtractedFolder(_sandbox);
            _package.AcceptVisitor(comparer);
        }
Ejemplo n.º 7
0
        public void TestExtractOverwritingExistingItems()
        {
            File.WriteAllText(Path.Combine(_sandbox, "file1"), @"Wrong content");
            File.WriteAllText(Path.Combine(_sandbox, "file0"), @"This file should not be touched");

            using (var extractor = ArchiveExtractor.Create(new MemoryStream(_archiveData), _sandbox, Archive.MimeTypeZip))
                extractor.Run();

            File.Exists(Path.Combine(_sandbox, "file0")).Should().BeTrue(because: "Extractor cleaned directory.");
            string file0Content = File.ReadAllText(Path.Combine(_sandbox, "file0"));
            file0Content.Should().Be("This file should not be touched");
            var comparer = new CompareHierarchyToExtractedFolder(_sandbox);
            _package.AcceptVisitor(comparer);
        }
Ejemplo n.º 8
0
        public void TestExtractOverwritingExistingItems()
        {
            File.WriteAllText(Path.Combine(_sandbox, "file1"), @"Wrong content");
            File.WriteAllText(Path.Combine(_sandbox, "file0"), @"This file should not be touched");

            using (var extractor = Extractor.FromStream(new MemoryStream(_archiveData), _sandbox, Model.Archive.MimeTypeZip))
                extractor.Run();

            Assert.IsTrue(File.Exists(Path.Combine(_sandbox, "file0")), "Extractor cleaned directory.");
            string file0Content = File.ReadAllText(Path.Combine(_sandbox, "file0"));
            Assert.AreEqual("This file should not be touched", file0Content);
            var comparer = new CompareHierarchyToExtractedFolder(_sandbox);
            _package.AcceptVisitor(comparer);
        }