public void SettingNoCategorySelectsAll() {
    var fixture = new TestFixture(typeof(Foo));
    var theTests = new MultipleTestsCriterion();
    theTests.Add(typeof(Foo).Assembly.FullName, typeof(Foo).FullName, string.Empty);
    fixture.Execute(new TestRun(theTests), new NullListener());
    Assert.Equals("#Foo.Bar#Foo.GreenFunc", Foo._messages);
 }
 public void ExecuteSelectedCategoryOnly() {
    var fixture = new TestFixture(typeof(Foo));
    var theTests = new MultipleTestsCriterion();
    theTests.Add(typeof(Foo).Assembly.FullName, typeof(Foo).FullName, string.Empty);
    var testRun = TestRun.Where(theTests).And(new CategoryCriterion("Green"));
    fixture.Execute(testRun, new NullListener());
    Assert.Equals("#Foo.GreenFunc", Foo._messages);
 }
 public void MethodInheritsCategoryFromFixture() {
    var fixture = new TestFixture(typeof(FooWithCategory));
    var theTests = new MultipleTestsCriterion();
    theTests.Add(typeof(FooWithCategory).Assembly.FullName, typeof(FooWithCategory).FullName, string.Empty);
    var testRun = TestRun.Where(theTests).And(new CategoryCriterion("Red"));
    fixture.Execute(testRun, new NullListener());
    Assert.Equals("#Foo.Bar#Foo.GreenFunc", FooWithCategory._messages);
 }
Example #4
0
      public void UnloadsAfterExecutionOfSubset() {
         var initialModuleCount = GetModuleCount();

         var setCriterion = new MultipleTestsCriterion();
         setCriterion.Add("TestDll", "TestDll.ClassWithTests", "ASucceedingTest");
         var listener = ExecuteLoaderAndListen(new TestRun(setCriterion));

         Assert.Equals(1, listener.ExecutedTests.Length, "ExecutedCount mismatch.");
         Assert.Contains("TestDll.ClassWithTests.ASucceedingTest", listener.ExecutedTests);
         Assert.Equals(initialModuleCount, GetModuleCount(), 
            "Loaded module count mismatch. AppDomain has not been unloaded.");
      }
 private void OnRecipeLoaded(object sender, RecipeEventArgs args) {
    _failedTestCriterion = new MultipleTestsCriterion();
    HookupRecipe();
 }
 protected override void Execute(object sender, EventArgs args) {
    if( RecipeFactory.Current != null ) {
       var multipleTestsCriterion = new MultipleTestsCriterion();
       foreach(var item in CsUnitControl.CheckedItems) {
          if( item.MethodFullName != string.Empty ) {
             multipleTestsCriterion.Add(item.AssemblyName, item.FixtureName, item.MethodName);
          }
          else if( item.FixtureName != string.Empty ) {
             multipleTestsCriterion.Add(item.AssemblyName, item.FixtureName, item.MethodName);
          }
       }
       RecipeFactory.Current.RunTests(new TestRun(multipleTestsCriterion));
    }
 }
 protected override void Execute(object sender, EventArgs args) {
    if(RecipeFactory.Current != null) {
       var setCriterion = new MultipleTestsCriterion();
       foreach (var item in CsUnitControl.SelectedItems) {
          var uiElemInfo = item;
          if (uiElemInfo != null) {
             setCriterion.Add(uiElemInfo.AssemblyName, uiElemInfo.FixtureName, uiElemInfo.MethodName);
          }
       }
       var testRun = new TestRun(setCriterion);
       RecipeFactory.Current.RunTests(testRun);
    }
 }
Example #8
0
 public void Cat2CategoryTestOnly() {
    var t = typeof(ClassWithCategories);
    var category = new CategoryCriterion("Cat2");
    var theTests = new MultipleTestsCriterion();
    theTests.Add(t.Assembly.FullName, t.FullName, "Cat1TestMethod");
    theTests.Add(t.Assembly.FullName, t.FullName, "Cat2TestMethod");
    theTests.Add(t.Assembly.FullName, t.FullName, "UncategorizedTestMethod");
    var testRun = TestRun.Where(theTests).And(category);
    _tc.Execute(testRun, new NullListener());
    Assert.Equals(" Cat2SetUp Cat2TestMethod Cat2TearDown", _methodSequence);
 }
Example #9
0
 public void RunAllCategories() {
    var setCriterion = new MultipleTestsCriterion();
    var t = typeof(ClassWithCategories);
    setCriterion.Add(t.Assembly.FullName, t.FullName, "Cat1TestMethod");
    setCriterion.Add(t.Assembly.FullName, t.FullName, "Cat2TestMethod");
    setCriterion.Add(t.Assembly.FullName, t.FullName, "UncategorizedTestMethod");
    _tc.Execute(new TestRun(setCriterion), new NullListener());
    Assert.Equals(" DefaultSetUp UncategorizedTestMethod DefaultTearDown" +
       " Cat1SetUp Cat1TestMethod Cat1TearDown" +
       " Cat2SetUp Cat2TestMethod Cat2TearDown",
       _methodSequence);
 }
Example #10
0
      public void CriterionAppliedWithMultipleAssemblies() {
         var recipe = RecipeFactory.NewRecipe("twoassemblies.deleteme.recipe");
         recipe.AddAssembly(_testDll);
         var testDll = Path.Combine(Util.SolutionCodeBase,
                                    "csUnit.CompatibilityTests\\NUnit-2.4.7\\bin\\Debug\\NUnit-2.4.7.dll");
         recipe.AddAssembly(testDll);
         var listener = new SimpleRecipeListener(recipe);

         recipe.RunTests(new TestRun(new AllTestsCriterion()));
         recipe.Join();
         Assert.Equals(7, listener.TestCount);
         Assert.Equals(5, listener.PassedCount);

         listener = new SimpleRecipeListener(recipe);
         var setCriterion = new MultipleTestsCriterion();
         setCriterion.Add("TestDll", "TestDll.ClassWithTests", "AFailingTest");
         setCriterion.Add("TestDll", "TestDll.ClassWithTests", "ATestWithError");
         recipe.RunTests(new TestRun(setCriterion));

         recipe.Join();
         Assert.Equals(2, listener.TestCount);
      }