Example #1
0
            public void NullChecks()
            {
                IEnumerable <string> input = null;

                // Act + Assert
                Assert.Null(ZipArchiveService.RemoveExtension(input));
            }
Example #2
0
            public void TheFileExtensionsAreRemoved()
            {
                IEnumerable <string> input = new string[] { "foo1.exe", "foo2.pdb", "foo3.dll", @"a\foo1.exe", @"a\foo2.pdb" };

                string[] expected = new string[] { "foo1", "foo2", "foo3", @"a\foo1", @"a\foo2" };

                // Act
                var result = ZipArchiveService.RemoveExtension(input);

                Assert.Equal(expected.Length, result.Count());
                foreach (string s in expected)
                {
                    Assert.Contains(s, result);
                }
            }
        /// <summary>
        /// Based on the snupkg, nupkg folder structure validate that the symbols have associated binary files.
        /// </summary>
        /// <param name="symbols">Symbol list extracted from the compressed folder.</param>
        /// <param name="PEs">The list of PE files extracted from the compressed folder.</param>
        /// <returns></returns>
        public static bool SymbolsHaveMatchingPEFiles(IEnumerable <string> symbols, IEnumerable <string> PEs)
        {
            if (symbols == null)
            {
                throw new ArgumentNullException(nameof(symbols));
            }
            if (PEs == null)
            {
                throw new ArgumentNullException(nameof(PEs));
            }
            var symbolsWithoutExtension = ZipArchiveService.RemoveExtension(symbols);
            var PEsWithoutExtensions    = ZipArchiveService.RemoveExtension(PEs);

            return(!symbolsWithoutExtension.Except(PEsWithoutExtensions, StringComparer.OrdinalIgnoreCase).Any());
        }