public bool IsRecognizedFile(IFileInspector fileInspector)
        {
            Stream stream;

            if (fileInspector.TryGetStream(out stream))
            {
                // Parse PE header/load import table.
                DllInfo info = Gallio.BoostAdapter.Utils.DllParser.GetDllInfo(stream);

                // No import table? Certainly not Boost.Test testable DLL then.
                if (info.ImportedDlls == null)
                {
                    return false;
                }

                // If there's reference to Boost.Test DLL - assume the DLL is testable.
                // This is not 100% correct - presence of test initialization function
                // should also be checked to be completely sure it can be tested, but
                // that would complicate things too much while providing little extra
                // benefits.
                foreach (string DllName in info.ImportedDlls)
                {
                    if (DllName.StartsWith(
                            "boost_unit_test_framework",
                            StringComparison.InvariantCultureIgnoreCase))
                    {
                        return true;
                    }
                }
            }

            return false;
        }
        /// <inheritdoc />
        public bool IsRecognizedFile(IFileInspector fileInspector)
        {
            Stream stream;
            if (fileInspector.TryGetStream(out stream))
            {
                return AssemblyUtils.IsAssembly(stream);
            }

            return false;
        }
예제 #3
0
        /// <inheritdoc />
        public bool IsRecognizedFile(IFileInspector fileInspector)
        {
            Stream stream;

            if (fileInspector.TryGetStream(out stream))
            {
                return(AssemblyUtils.IsAssembly(stream));
            }

            return(false);
        }
        /// <inheritdoc />
        public bool IsRecognizedFile(IFileInspector fileInspector)
        {
            Stream stream;

            if (!fileInspector.TryGetStream(out stream))
                return false;

            using (var reader = new PEImageReader(stream))
            {
                PEImageInfo info = reader.Read();
                return (info != null) && info.Exports.Contains("MbUnitCpp_RunTest");
            }
        }
        /// <inheritdoc />
        public bool IsRecognizedFile(IFileInspector fileInspector)
        {
            Stream stream;

            if (!fileInspector.TryGetStream(out stream))
            {
                return(false);
            }

            using (var reader = new PEImageReader(stream))
            {
                PEImageInfo info = reader.Read();
                return((info != null) && info.Exports.Contains("MbUnitCpp_RunTest"));
            }
        }
        private static IList <AssemblyName> GetAssemblyReferences(IFileInspector fileInspector)
        {
            Stream stream;

            if (fileInspector.TryGetStream(out stream))
            {
                AssemblyMetadata assemblyMetadata = AssemblyUtils.GetAssemblyMetadata(stream, AssemblyMetadataFields.AssemblyReferences);
                if (assemblyMetadata != null)
                {
                    return(assemblyMetadata.AssemblyReferences);
                }
            }

            return(EmptyArray <AssemblyName> .Instance);
        }