コード例 #1
0
ファイル: TestRunner.cs プロジェクト: VitalyTVA/CastleSiege
 private void LogHandler(string condition, string stacktrace, LogType type)
 {
     testMessages += condition + "\n";
     if (type == LogType.Exception)
     {
         var exceptionType = condition.Substring(0, condition.IndexOf(':'));
         if (currentTest.IsExceptionExpected(exceptionType))
         {
             testMessages += exceptionType + " was expected\n";
             if (currentTest.ShouldSucceedOnException())
             {
                 testState = TestState.Success;
             }
         }
         else
         {
             testState       = TestState.Exception;
             this.stacktrace = stacktrace;
         }
     }
     else if (type == LogType.Log)
     {
         if (testState == TestState.Running && condition.StartsWith(IntegrationTest.passMessage))
         {
             testState = TestState.Success;
         }
         if (condition.StartsWith(IntegrationTest.failMessage))
         {
             testState = TestState.Failure;
         }
     }
 }
コード例 #2
0
ファイル: TestRunner.cs プロジェクト: smdx24/CPI-Source-Code
        private void LogHandler(string condition, string stacktrace, LogType type)
        {
            if (!condition.StartsWith("IntegrationTest Started") && !condition.StartsWith("IntegrationTest Finished"))
            {
                string text = condition;
                if (text.StartsWith("IntegrationTest"))
                {
                    text = text.Substring("IntegrationTest".Length + 1);
                }
                if (currentTest != null && text.EndsWith("(" + currentTest.name + ')'))
                {
                    text = text.Substring(0, text.LastIndexOf('('));
                }
                m_TestMessages = m_TestMessages + text + "\n";
            }
            switch (type)
            {
            case LogType.Exception:
            {
                string text2 = condition.Substring(0, condition.IndexOf(':'));
                if (currentTest != null && currentTest.IsExceptionExpected(text2))
                {
                    m_TestMessages = m_TestMessages + text2 + " was expected\n";
                    if (currentTest.ShouldSucceedOnException())
                    {
                        m_TestState = TestState.Success;
                    }
                }
                else
                {
                    m_TestState  = TestState.Exception;
                    m_Stacktrace = stacktrace;
                }
                break;
            }

            case LogType.Error:
            case LogType.Assert:
                m_TestState  = TestState.Failure;
                m_Stacktrace = stacktrace;
                break;

            case LogType.Log:
                if (m_TestState == TestState.Running && condition.StartsWith("IntegrationTest Pass"))
                {
                    m_TestState = TestState.Success;
                }
                if (condition.StartsWith("IntegrationTest Fail"))
                {
                    m_TestState = TestState.Failure;
                }
                break;

            case LogType.Warning:
                break;
            }
        }
コード例 #3
0
ファイル: TestRunner.cs プロジェクト: wmleungab/UST-Escape
        private void LogHandler(string condition, string stacktrace, LogType type)
        {
            if (!condition.StartsWith(k_StartedMessage) && !condition.StartsWith(k_FinishedMessage))
            {
                var msg = condition;
                if (msg.StartsWith(k_Prefix))
                {
                    msg = msg.Substring(k_Prefix.Length + 1);
                }
                if (currentTest != null && msg.EndsWith("(" + currentTest.name + ')'))
                {
                    msg = msg.Substring(0, msg.LastIndexOf('('));
                }
                m_TestMessages += msg + "\n";
            }
            switch (type)
            {
            case LogType.Exception:
            {
                var exceptionType = condition.Substring(0, condition.IndexOf(':'));
                if (currentTest != null && currentTest.IsExceptionExpected(exceptionType))
                {
                    m_TestMessages += exceptionType + " was expected\n";
                    if (currentTest.ShouldSucceedOnException())
                    {
                        m_TestState = TestState.Success;
                    }
                }
                else
                {
                    m_TestState  = TestState.Exception;
                    m_Stacktrace = stacktrace;
                }
            }
            break;

            case LogType.Assert:
            case LogType.Error:
                m_TestState  = TestState.Failure;
                m_Stacktrace = stacktrace;
                break;

            case LogType.Log:
                if (m_TestState == TestState.Running && condition.StartsWith(IntegrationTest.passMessage))
                {
                    m_TestState = TestState.Success;
                }
                if (condition.StartsWith(IntegrationTest.failMessage))
                {
                    m_TestState = TestState.Failure;
                }
                break;
            }
        }
コード例 #4
0
 private void LogHandler(string condition, string stacktrace, LogType type)
 {
     if (!condition.StartsWith(startedMessage) && !condition.StartsWith(finishedMessage))
     {
         var msg = condition;
         if (msg.StartsWith(prefix))
         {
             msg = msg.Substring(prefix.Length + 1);
         }
         if (currentTest != null && msg.EndsWith("(" + currentTest.name + ')'))
         {
             msg = msg.Substring(0, msg.LastIndexOf('('));
         }
         testMessages += msg + "\n";
     }
     if (type == LogType.Exception)
     {
         var exceptionType = condition.Substring(0, condition.IndexOf(':'));
         if (currentTest.IsExceptionExpected(exceptionType))
         {
             testMessages += exceptionType + " was expected\n";
             if (currentTest.ShouldSucceedOnException())
             {
                 testState = TestState.Success;
             }
         }
         else
         {
             testState       = TestState.Exception;
             this.stacktrace = stacktrace;
         }
     }
     else if (type == LogType.Error || type == LogType.Assert)
     {
         testState       = TestState.Failure;
         this.stacktrace = stacktrace;
     }
     else if (type == LogType.Log)
     {
         if (testState == TestState.Running && condition.StartsWith(IntegrationTest.passMessage))
         {
             testState = TestState.Success;
         }
         if (condition.StartsWith(IntegrationTest.failMessage))
         {
             testState = TestState.Failure;
         }
     }
 }