void RecipeFactory_Loaded(object sender, RecipeEventArgs args) {
    _results = new DefaultXmlWriter(RecipeFactory.Current, string.Empty);
    RecipeFactory.Current.Finished += Current_Finished;
    Enabled = false;
 }
Esempio n. 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;
      }
 public SaveResultsAsXmlCommand(ICommandTarget commandTarget, CsUnitControl csUnitCtrl)
    : base(commandTarget, csUnitCtrl, "&File", "Save Result As &XML...", _menuPosition, true) {
    _results = new DefaultXmlWriter(RecipeFactory.Current, string.Empty);
    RecipeFactory.Loaded += RecipeFactory_Loaded;
    Enabled = false;
 }
Esempio n. 4
0
      private void MainForm_Load(object sender, EventArgs e) {
         var config = new ConfigCurrentUser();
         Location = config.MainFormLocation;
         Size = config.MainFormSize;

         Command.CreateCommands(this, _csUnitControl);
         Command.FillToolStrip(_toolStrip);

         if( _clh.HasOption("recipe") ) {
            if( Utils.FileExists(_clh.GetOptionValueFor("recipe"), true)) {
               RecipeFactory.Load(_clh.GetOptionValueFor("recipe"));
            }
         }
         else if( _clh.HasOption("assembly") ) {
            if( Utils.FileExists(_clh.GetOptionValueFor("assembly"), true)) {
               var assemblyPathName = _clh.GetOptionValueFor("assembly");
               if( !Path.IsPathRooted(assemblyPathName) ) {
                  assemblyPathName = Path.Combine(Environment.CurrentDirectory, assemblyPathName);
               }
               RecipeFactory.Current.AddAssembly(assemblyPathName);
            }
         }
         else switch(config.StartupLoadItem) {
            case "Recipe":
               if(   config.RecentRecipies.Count > 0
                     && Utils.FileExists(config.RecentRecipies[0], true) ) {
                  RecipeFactory.Load(config.RecentRecipies[0]);
               }
               break;
            case "Assembly":
               if(   config.RecentAssemblies.Count > 0
                     && Utils.FileExists(config.RecentAssemblies[0], true)) {
                  RecipeFactory.Current.AddAssembly(config.RecentAssemblies[0]);
               }
               break;
         }
         
         // Setup the xml handler
         if( _clh.HasOption("xml") ) {
            _xmlWriter = new DefaultXmlWriter(RecipeFactory.Current, _clh.GetOptionValueFor("xml"));
         }

         // Automatically start the recipe
         if( _clh.HasOption("autorun") ) {
            if(RecipeFactory.Current != null) {
               var testRun = new TestRun(new AllTestsCriterion());
               RecipeFactory.Current.RunTests(testRun);
            }
         }
      }