/// <summary>
        /// Enumerates all log entries which are deemed to be an error (i.e. Warning, Error, Fatal Error and Exception).
        /// </summary>
        /// <param name="result">The TestResult which hosts the log entries.</param>
        /// <returns>An enumeration of error flagging log entries.</returns>
        private static IEnumerable<LogEntry> GetErrors(BoostTestAdapter.Boost.Results.TestResult result)
        {
            IEnumerable<LogEntry> errors = result.LogEntries.Where((e) =>
                                                    (e is LogEntryWarning) ||
                                                    (e is LogEntryError) ||
                                                    (e is LogEntryFatalError) ||
                                                    (e is LogEntryException)
                                               );

            // Only provide a single memory leak error if the test succeeded successfully (i.e. all asserts passed)
            return (errors.Any() ? errors : result.LogEntries.Where((e) => (e is LogEntryMemoryLeak)).Take(1));
        }
        /// <summary>
        /// Compresses a message so that it is suitable for the UI.
        /// </summary>
        /// <param name="result">The erroneous LogEntry whose message is to be displayed.</param>
        /// <returns>A compressed message suitable for UI.</returns>
        private static string GetErrorMessage(BoostTestAdapter.Boost.Results.TestResult result)
        {
            StringBuilder sb = new StringBuilder();

            foreach (LogEntry error in GetErrors(result))
            {
                sb.Append(error.Detail).Append(Environment.NewLine);
            }

            // Remove redundant NewLine at the end
            sb.Remove((sb.Length - Environment.NewLine.Length), Environment.NewLine.Length);

            return sb.ToString();
        }
 /// <summary>
 /// Given a TestResult returns the last error type log entry.
 /// </summary>
 /// <param name="result">The TestResult which hosts the necessary log entries</param>
 /// <returns>The last error type log entry or null if none are available.</returns>
 private static LogEntry GetLastError(BoostTestAdapter.Boost.Results.TestResult result)
 {
     // Select the last error issued within a Boost Test report
     return GetErrors(result).LastOrDefault();
 }
        /// <summary>
        /// Converts the log entries stored within the provided test result into equivalent
        /// Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResultMessages
        /// </summary>
        /// <param name="result">The Boost.Test.Result.TestResult whose LogEntries are to be converted.</param>
        /// <returns>An enumeration of TestResultMessage equivalent to the Boost log entries stored within the provided TestResult.</returns>
        private static IEnumerable<TestResultMessage> GetTestMessages(BoostTestAdapter.Boost.Results.TestResult result)
        {
            foreach (LogEntry entry in result.LogEntries)
            {
                string category = null;

                if (
                    (entry is LogEntryInfo) ||
                    (entry is LogEntryMessage) ||
                    (entry is LogEntryStandardOutputMessage)
                )
                {
                    category = TestResultMessage.StandardOutCategory;
                }
                else if (
                    (entry is LogEntryWarning) ||
                    (entry is LogEntryError) ||
                    (entry is LogEntryFatalError) ||
                    (entry is LogEntryMemoryLeak) ||
                    (entry is LogEntryException) ||
                    (entry is LogEntryStandardErrorMessage)
                )
                {
                    category = TestResultMessage.StandardErrorCategory;
                }
                else
                {
                    // Skip unknown message types
                    continue;
                }

                yield return new TestResultMessage(category, GetTestResultMessageText(result.Unit, entry));
            }
        }