GoogleTestAdapter.TestCases.TestCaseResolver.FindTestCaseLocationsInBinary C# (CSharp) Method

FindTestCaseLocationsInBinary() private method

private FindTestCaseLocationsInBinary ( string binary, List testMethodSignatures, string symbolFilterString, string pathExtension ) : IEnumerable
binary string
testMethodSignatures List
symbolFilterString string
pathExtension string
return IEnumerable
        private IEnumerable<TestCaseLocation> FindTestCaseLocationsInBinary(
            string binary, List<string> testMethodSignatures, string symbolFilterString, string pathExtension)
        {
            using (IDiaResolver diaResolver = _diaResolverFactory.Create(binary, pathExtension, _testEnvironment, _testEnvironment.Options.DebugMode))
            {
                try
                {
                    IList<SourceFileLocation> allTestMethodSymbols = diaResolver.GetFunctions(symbolFilterString);
                    IList<SourceFileLocation> allTraitSymbols = diaResolver.GetFunctions("*" + TraitAppendix);
                    _testEnvironment.DebugInfo($"Found {allTestMethodSymbols.Count} test method symbols and {allTraitSymbols.Count} trait symbols in binary {binary}");

                    return allTestMethodSymbols
                        .Where(nsfl => testMethodSignatures.Any(tms => Regex.IsMatch(nsfl.Symbol, tms))) // Contains() instead of == because nsfl might contain namespace
                        .Select(nsfl => ToTestCaseLocation(nsfl, allTraitSymbols))
                        .ToList(); // we need to force immediate query execution, otherwise our session object will already be released
                }
                catch (Exception e)
                {
                    if (_testEnvironment.Options.DebugMode)
                        _testEnvironment.LogError($"Exception while resolving test locations and traits in {binary}\n{e}");
                    return new TestCaseLocation[0];
                }
            }
        }