public void TestInnerExceptionExists()
        {
            ScriptRuntimeException.EnableDisplayInnerException = true;
            SourceSpan testSourcespanObject = new SourceSpan("fileName", new TextPosition(0, 0, 0), new TextPosition(0, 0, 0));
            Exception  exception            = Substitute.For <Exception>();

            exception.StackTrace.Returns("TestStacTrace");
            exception.Message.Returns("Test RunTime message");

            ScriptRuntimeException testScriptruntimeObject = new ScriptRuntimeException(testSourcespanObject, "Any string", exception);

            Assert.True(testScriptruntimeObject.ToString().Contains("TestStacTrace"));
            Assert.True(testScriptruntimeObject.ToString().Contains("Test RunTime message"));
        }
        public void TestInnerExceptiondosentExists()
        {
            ScriptRuntimeException.EnableDisplayInnerException = true;
            SourceSpan testSourcespanObject = new SourceSpan("fileName", new TextPosition(0, 0, 0), new TextPosition(0, 0, 0));

            ScriptRuntimeException testScriptruntimeObject = new ScriptRuntimeException(testSourcespanObject, "Any string");

            Assert.AreEqual(testScriptruntimeObject.ToString(), testScriptruntimeObject.Message);
        }
Пример #3
0
 public bool SignalRuntimeException(ScriptRuntimeException ex)
 {
     MessageBoxEx.Show(MainForm.TheMainForm, ex.ToString());
     throw ex;
 }