コード例 #1
0
        public override string GetResultText()
        {
            var tempTest = result;
            var sb       = new StringBuilder(tempTest.Name);

            if (tempTest.Executed)
            {
                sb.AppendFormat(" ({0}s)", tempTest.Duration.ToString("##0.###"));
            }
            sb.AppendLine();

            if (!string.IsNullOrEmpty(tempTest.Message))
            {
                sb.AppendFormat("---\n{0}\n", tempTest.Message.Trim());
            }
            if (!string.IsNullOrEmpty(tempTest.Logs))
            {
                sb.AppendFormat("---\n{0}\n", tempTest.Logs.Trim());
            }
            if (!tempTest.IsSuccess && !string.IsNullOrEmpty(tempTest.StackTrace))
            {
                var stackTrace = StackTraceFilter.Filter(tempTest.StackTrace).Trim();
                sb.AppendFormat("---\n{0}\n", stackTrace);
            }
            if (sb.Length > m_maxLineLenght)
            {
                sb.Length = m_maxLineLenght;
                sb.AppendFormat("...\n\n---MESSAGE TRUNCATED AT {0} CHARACTERS---", m_maxLineLenght);
            }
            return(sb.ToString().Trim());
        }
コード例 #2
0
        public override string GetResultText()
        {
            var tempTest = result;
            var text     = tempTest.Name;

            if (tempTest.Executed)
            {
                text += " (" + tempTest.Duration.ToString("##0.###") + "s)";
            }
            if (!tempTest.IsSuccess)
            {
                text += "\n";
                if (!string.IsNullOrEmpty(tempTest.Message))
                {
                    text += "---\n";
                    text += tempTest.Message.Trim();
                }
                if (!string.IsNullOrEmpty(tempTest.StackTrace))
                {
                    var stackTrace = StackTraceFilter.Filter(tempTest.StackTrace).Trim();
                    text += "\n---EXCEPTION---\n" + stackTrace;
                }
            }
            return(text.Trim());
        }
コード例 #3
0
        public void RenderInfo()
        {
            string text = null;

            if (selectedTests.Count == 1)
            {
                var test = selectedTests.Single();
                text = test.Name;
                if (test.Executed)
                {
                    text += " (" + test.Duration.ToString("##0.###") + "s)";
                }
                if (!test.IsSuccess)
                {
                    text += "\n";
                    if (!string.IsNullOrEmpty(test.Message))
                    {
                        text += "---\n";
                        text += test.Message.Trim();
                    }
                    if (!string.IsNullOrEmpty(test.StackTrace))
                    {
                        var stackTrace = StackTraceFilter.Filter(test.StackTrace).Trim();
                        text += "\n---EXCEPTION---\n" + stackTrace;
                    }
                }
                text = text.Trim();
            }
            EditorGUILayout.SelectableLabel(text, Styles.info);
        }
コード例 #4
0
 private void WriteFailureElement(ITestResult result)
 {
     WriteOpeningElement("failure");
     WriteOpeningElement("message");
     WriteCData(result.Message);
     WriteClosingElement("message");
     WriteOpeningElement("stack-trace");
     if (result.StackTrace != null)
     {
         WriteCData(StackTraceFilter.Filter(result.StackTrace));
     }
     WriteClosingElement("stack-trace");
     WriteClosingElement("failure");
 }
        public void RenderInfo()
        {
            string printedName = null;

            if (selectedTests.Count == 1)
            {
                printedName = "";
                if (!string.IsNullOrEmpty(selectedTests.Single().Message))
                {
                    printedName += selectedTests.Single().Message.Trim();
                }
                if (!string.IsNullOrEmpty(selectedTests.Single().StackTrace))
                {
                    var stackTrace = StackTraceFilter.Filter(selectedTests.Single().StackTrace).Trim();
                    printedName += "\n\n---EXCEPTION---\n" + stackTrace;
                }
                printedName = printedName.Trim();
            }

            EditorGUILayout.SelectableLabel(
                printedName, Styles.info);
        }