예제 #1
0
        internal int ExecuteValidCommandLine(CmdLineHandler clh, IRecipe recipe)
        {
            var result = 0;

            SetUpCategorySelector("testCategory", clh, recipe);
            SetUpCategorySelector("fixtureCategory", clh, recipe);
            SetUpRegexSelector(clh, recipe);

            DefaultXmlWriter resultWriter = null;

            if (clh.HasOption("xml"))
            {
                var resultPathName = clh.GetOptionValueFor("xml");
                resultPathName = resultPathName == string.Empty ? "csUnit.results.xml" : resultPathName;
                resultWriter   = new DefaultXmlWriter(recipe, resultPathName);
            }

            recipe.Aborted += RecipeAborted;
            recipe.RunTests(new TestRun(new AllTestsCriterion()));

            recipe.Join();

            if (resultWriter != null)
            {
                resultWriter.Save();
                result = resultWriter.Result;
            }
            if (result == 0 && _recipeAborted)
            {
                Console.Error.WriteLine("Tests Aborted: " + _recipeAbortMessage);
                result = 2;
            }
            return(result);
        }
예제 #2
0
      internal int ExecuteValidCommandLine(CmdLineHandler clh, IRecipe recipe) {
         var result = 0;
         SetUpCategorySelector("testCategory", clh, recipe);
         SetUpCategorySelector("fixtureCategory", clh, recipe);
         SetUpRegexSelector(clh, recipe);

         DefaultXmlWriter resultWriter = null;
         if(clh.HasOption("xml")) {
            var resultPathName = clh.GetOptionValueFor("xml");
            resultPathName = resultPathName == string.Empty ? "csUnit.results.xml" : resultPathName;
            resultWriter = new DefaultXmlWriter(recipe, resultPathName);
         }

         recipe.Aborted += RecipeAborted;
         recipe.RunTests(new TestRun(new AllTestsCriterion()));

         recipe.Join();

         if(resultWriter != null) {
            resultWriter.Save();
            result = resultWriter.Result;
         }
         if (result == 0 && _recipeAborted) {
            Console.Error.WriteLine("Tests Aborted: " + _recipeAbortMessage);
            result = 2;
         }
         return result;
      }