private static string GetTestResultMessageText(TestUnit unit, LogEntry entry)
        {
            Code.Require(unit, "unit");
            Code.Require(entry, "entry");

            if ((entry is LogEntryStandardOutputMessage) || (entry is LogEntryStandardErrorMessage))
            {
                return entry.Detail.TrimEnd() + Environment.NewLine;
            }

            StringBuilder sb = new StringBuilder();

            if (entry.Source != null)
            {
                AppendSourceInfo(entry.Source, sb);
            }

            sb.Append(entry.ToString().ToLowerInvariant()).
                Append(" in \"").
                Append(unit.Name).
                Append("\"");

            LogEntryMemoryLeak memoryLeak = entry as LogEntryMemoryLeak;
            if (memoryLeak == null)
            {
                sb.Append(": ").Append(entry.Detail.TrimEnd());
            }

            LogEntryException exception = entry as LogEntryException;
            if (exception != null)
            {
                FormatException(exception, sb);
            }

            LogEntryError error = entry as LogEntryError;
            if (error != null)
            {
                FormatError(error, sb);
            }

            if (memoryLeak != null)
            {
                FormatMemoryLeak(memoryLeak, sb);
            }

            // Append NewLine so that log entries are listed one per line
            return sb.Append(Environment.NewLine).ToString();
        }
        private static string GetTestResultMessageText(TestUnit unit, LogEntry entry)
        {
            if ((entry is LogEntryStandardOutputMessage) || (entry is LogEntryStandardErrorMessage))
            {
                return entry.Detail.TrimEnd() + Environment.NewLine;
            }

            StringBuilder sb = new StringBuilder();

            if (entry.Source != null)
            {
                AppendSourceInfo(entry.Source, sb);
            }

            sb.Append(entry.ToString().ToLowerInvariant()).
                Append(" in \"").
                Append(unit.Name).
                Append("\"");

            LogEntryMemoryLeak memoryLeak = entry as LogEntryMemoryLeak;
            if (memoryLeak == null)
            {
                sb.Append(": ").Append(entry.Detail.TrimEnd());
            }

            LogEntryException exception = entry as LogEntryException;
            if (exception != null)
            {
                if (exception.LastCheckpoint != null)
                {
                    sb.Append(Environment.NewLine);
                    AppendSourceInfo(exception.LastCheckpoint, sb);
                    sb.Append("last checkpoint: ").Append(exception.CheckpointDetail);
                }
            }

            if (memoryLeak != null)
            {
                if ((memoryLeak.LeakSourceFilePath != null) && (memoryLeak.LeakSourceFileName != null))
                {
                    sb.Append("source file path leak detected at :").
                        Append(memoryLeak.LeakSourceFilePath).
                        Append(memoryLeak.LeakSourceFileName);
                }

                if (memoryLeak.LeakLineNumber != null)
                {
                    sb.Append(", ").
                        Append("Line number: ").
                        Append(memoryLeak.LeakLineNumber);
                }

                sb.Append(", ").
                    Append("Memory allocation number: ").
                    Append(memoryLeak.LeakMemoryAllocationNumber);

                sb.Append(", ").
                    Append("Leak size: ").
                    Append(memoryLeak.LeakSizeInBytes).
                    Append(" byte");
                
                if (memoryLeak.LeakSizeInBytes > 0)
                {
                     sb.Append('s');
                }

                sb.Append(Environment.NewLine).
                    Append(memoryLeak.LeakLeakedDataContents);
            }

            // Append NewLine so that log entries are listed one per line
            return sb.Append(Environment.NewLine).ToString();
        }
        /// <summary>
        /// Tests the provided LogEntry's general properties against the expected values
        /// </summary>
        /// <param name="entry">The LogEntryException to test</param>
        /// <param name="entryType">The expected log entry type</param>
        /// <param name="message">The expected log message</param>
        /// <param name="info">The expected source file information for the log entry</param>
        private void AssertLogEntryDetails(LogEntry entry, string entryType, string message, SourceFileInfo info)
        {
            Assert.That(entry.ToString(), Is.EqualTo(entryType));
            Assert.That(entry.Detail, Is.EqualTo(message));

            AssertSourceInfoDetails(entry.Source, info);
        }