public override void SetUp()
		{
			base.SetUp();
			AddCodeFile("test.cs", @"using NUnit.Framework;
namespace RootNamespace.Tests {
	[TestFixture]
	class MyTestFixture {
		[Test] public void TestMethod1() {}
		[Test] public void TestMethod2() {}
	}
}");
			testClass = testProject.GetTestClass(new FullTypeName("RootNamespace.Tests.MyTestFixture"));
			testMethod1 = testClass.FindTestMethod("TestMethod1");
			testMethod2 = testClass.FindTestMethod("TestMethod2");
		}
        public override void UpdateTestResult(TestResult result)
        {
            int lastDot = result.Name.LastIndexOf('.');

            if (lastDot < 0)
            {
                return;
            }
            string         fixtureName = result.Name.Substring(0, lastDot);
            string         methodName  = result.Name.Substring(lastDot + 1);
            NUnitTestClass testClass   = GetTestClass(new FullTypeName(fixtureName));

            if (testClass == null)
            {
                // maybe it's an inherited test
                int secondToLastDot = result.Name.LastIndexOf('.', lastDot - 1);
                if (secondToLastDot >= 0)
                {
                    string fixtureName2 = result.Name.Substring(0, secondToLastDot);
                    methodName = result.Name.Substring(secondToLastDot + 1);
                    testClass  = GetTestClass(new FullTypeName(fixtureName2));
                }
            }
            if (testClass != null)
            {
                NUnitTestMethod testMethod = testClass.FindTestMethod(methodName);
                if (testMethod != null)
                {
                    testMethod.UpdateTestResult(result);
                }
            }
        }
		public override void SetUp()
		{
			base.SetUp();
			AddCodeFileInNamespace("base.cs", @"
abstract class MyTestFixtureBase {
	[Test] public void MyTest() {}
	[Test] public void MyTest() {}
}");
			AddCodeFileInNamespace("derived.cs", @"
class MyTestFixture : MyTestFixtureBase {
	[Test] public void MyTest() {}
	[Test] public void MyTest() {}
}");
			testClass = testProject.NestedTests.Cast<NUnitTestClass>().Single(c => c.ClassName == "MyTestFixture");
			baseMethod = testClass.FindTestMethod("MyTestFixtureBase.MyTest");
			derivedMethod = testClass.FindTestMethod("MyTest");
		}
Beispiel #4
0
		ITest GetTestForEntityInClass(NUnitTestClass c, IEntity entity)
		{
			if (c == null)
				return null;
			if (entity.SymbolKind == SymbolKind.TypeDefinition)
				return c;
			else if (entity.SymbolKind == SymbolKind.Method)
				return c.FindTestMethod(entity.Name);
			else
				return null;
		}
 ITest GetTestForEntityInClass(NUnitTestClass c, IEntity entity)
 {
     if (c == null)
     {
         return(null);
     }
     if (entity.SymbolKind == SymbolKind.TypeDefinition)
     {
         return(c);
     }
     else if (entity.SymbolKind == SymbolKind.Method)
     {
         return(c.FindTestMethod(entity.Name));
     }
     else
     {
         return(null);
     }
 }