Ejemplo n.º 1
0
        static void tvUserAlertActionRequired_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
        {
            UTGHelper.UserAlertActionRequired tvUserAlertActionRequired = (UTGHelper.UserAlertActionRequired)sender;

            if (tvUserAlertActionRequired.ApplicableAcctionState == UserAlertActionRequired.ApplicableAcction.ignore)
            {
                return;
            }

            if (tvUserAlertActionRequired.ApplicableAcctionState == UserAlertActionRequired.ApplicableAcction.mutate)
            {
                HandelCodeClassSelection((AbstractTestFramework)tvUserAlertActionRequired.TestFramework, (CodeFunction)tvUserAlertActionRequired.FormCodeElement, tvUserAlertActionRequired.FormApplicationObject, (UnitTestCodeType)tvUserAlertActionRequired.FromCodeType);
            }
        }
Ejemplo n.º 2
0
      private static void OnCodeClassSelection(AbstractTestFramework testFramework, CodeProperty ce, DTE2 applicationObject, UnitTestCodeType codeType)
      {
         Project parentProject = ProjectExaminar.GetCodeClassParentProject((CodeClass)ce.Parent);

         Project unitTestProject = ProjectExaminar.GetUnitTestProject(parentProject.Name, applicationObject, testFramework.TestProjectPostFix);

         if (unitTestProject == null) {

            OnCodeClassSelection(testFramework, (CodeClass)ce.Parent, (CodeElement)ce, applicationObject, codeType);
            return;
         }

         //In cases where we can not simply generate automatically (definition already exists) we will
         //ask the user for input, wait on input, then async back to the function actual useful handler
         //HandelCodeClassSelection
         if (!CanGenerateHandleCodeProperty(testFramework.TestClassFixturePostFix, (CodeClass)ce.Parent, ce, unitTestProject))
         {
            UTGHelper.UserAlertActionRequired tvUserAlertActionRequired = new UserAlertActionRequired(
               "Property definition already exits! What would you like to do?",
               typeof(CodeProperty),
               (CodeElement)ce,
               ref applicationObject,
               codeType,
               testFramework);

            if (!tvUserAlertActionRequired.IsDisposed)
            {
               tvUserAlertActionRequired.FormClosed += new System.Windows.Forms.FormClosedEventHandler(tvUserAlertActionRequired_FormClosed);

               tvUserAlertActionRequired.Show();
            }
            else
            {
               HandelCodeClassSelection(testFramework, ce, applicationObject, codeType);
            }

            return;
         }

         //otherwise simply call HandelCodeClassSelection
         HandelCodeClassSelection(testFramework, ce, applicationObject, codeType);

      }