Пример #1
0
 private void btTest_Click(object sender, EventArgs e)
 {
     btTest.Enabled = false;
     try
     {
         //check if compilation is needed
         _testData = null;
         IObjectTypeUnitTester uc = (IObjectTypeUnitTester)MathNode.GetService(typeof(IObjectTypeUnitTester));
         if (uc != null)
         {
             _testData = uc.UseMemberTest(this);
         }
         if (_testData == null)
         {
             //
             CompileResult result = mathExpCtrl1.CreateMethodCompilerUnit("TestMathExpression", "Test", "TestMathExpression");
             //
             thTest = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(test));
             thTest.SetApartmentState(System.Threading.ApartmentState.STA);
             _testData = new TestData(result);                    //"Test", "TestMathExpression", variables, pointerList, code, imports);
             thTest.Start(_testData);
         }
         timer1.Enabled = true;
     }
     catch (Exception err)
     {
         MathNode.Log(this.FindForm(), err);
     }
     //
     timer1.Enabled = true;
 }
Пример #2
0
 private void btTest_Click(object sender, EventArgs e)
 {
     btTest.Enabled = false;
     try
     {
         _testData = null;
         //generate the result
         result = root.Export();
         //
         //check if compilation is needed
         IObjectTypeUnitTester uc = (IObjectTypeUnitTester)MathNode.GetService(typeof(IObjectTypeUnitTester));
         if (uc != null)
         {
             _testData = uc.UseMemberTest(this);
         }
         if (_testData == null)
         {
             CompileResult compiled = result.CreateMethodCompilerUnit("TestMathExpression", "Test", "TestMathExpGroup");
             //
             thTest = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(test));
             thTest.SetApartmentState(System.Threading.ApartmentState.STA);
             _testData = new TestData(compiled);
             thTest.Start(_testData);
         }
         //
         timer1.Enabled = true;
     }
     catch (Exception err)
     {
         MathNode.Log(this.FindForm(), err);
     }
 }