Ejemplo n.º 1
0
            public void ExtractReturnsTheListOfFileEntriesWithFilter()
            {
                // Arrange
                IReadOnlyCollection <ZipArchiveEntry> input = CreateTestZipEntries(new string[] { "foo.dll", "bar.exe", "foobar.dll", @"a\bar.dll" });
                var symbolFilter = new HashSet <string>()
                {
                    "foo.pdb", @"a\bar.pdb"
                };

                // Extract only the file with the same path entry as the input but ignoring the extension
                string[] expected = new string[] { "foo.dll", @"a\bar.dll" };

                var service = new TestZipArchiveService();

                // Act
                var result = service.Extract(input, "Dir1", null, symbolFilter);

                // Assert
                Assert.Equal(expected.Length, result.Count());
                Assert.True(service.OnExtractInvoked);
                foreach (string s in expected)
                {
                    Assert.Contains(s, result);
                }
            }
Ejemplo n.º 2
0
            public void ExtractReturnsTheListOfFileEntriesNoFilter()
            {
                // Arrange
                IReadOnlyCollection <ZipArchiveEntry> input = CreateTestZipEntries(new string[] { "foo.pdb", "bar.txt", "foobar.dll", @"a\bar.pdb" });

                string[] expected = new string[] { "foo.pdb", "bar.txt", "foobar.dll", @"a\bar.pdb" };
                var      service  = new TestZipArchiveService();

                // Act
                var result = service.Extract(input, "Dir1");

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