Esempio n. 1
0
            public void NullCheck()
            {
                IReadOnlyCollection <ZipArchiveEntry> input = null;

                // Act + Assert
                Assert.Throws <ArgumentNullException>(() => ZipArchiveService.ReadFilesFromZipStream(input, ".exe"));
            }
Esempio n. 2
0
            public void NullCheck()
            {
                // Arrange
                IReadOnlyCollection <ZipArchiveEntry> input = new ReadOnlyCollection <ZipArchiveEntry>(new List <ZipArchiveEntry>());
                var service = new ZipArchiveService();

                // Act + Assert
                Assert.Throws <ArgumentNullException>(() => service.Extract(null, "Dir1", new List <string> {
                    ".pdb"
                }));
                Assert.Throws <ArgumentNullException>(() => ZipArchiveService.ReadFilesFromZipStream(input, null));
            }
Esempio n. 3
0
            public void TheCorrectExtensionsAreFiltered()
            {
                // Arrange
                IReadOnlyCollection <ZipArchiveEntry> input = CreateTestZipEntries(new string[] { "foo.pdb", "bar.txt", "foobar.dll", @"a\bar.pdb" });

                string[] expected = new string[] { "foo.pdb", @"a\bar.pdb" };

                // Act
                var result = ZipArchiveService.ReadFilesFromZipStream(input, ".pdb");

                // Assert
                Assert.Equal(expected.Length, result.Count());
                foreach (string s in expected)
                {
                    Assert.Contains(s, result);
                }
            }