public void RunGenericFixtureWithThreeAttributes() { GenericTestCounters.ResetCounters(); Test suite = _suiteBuilder.BuildFrom(typeof(GenericFixtureWithThreeAttributes <>)); TestResult testResult = suite.Run(NullListener.NULL); Assert.That(testResult.IsSuccess, "All tests are successful."); Assert.That(GenericTestCounters.Test.Value, Is.EqualTo(6), "Executed 6 tests"); Assert.That(GenericTestCounters.SetUp.Value, Is.EqualTo(6), "Execute SetUp 3 times"); Assert.That(GenericTestCounters.TearDown.Value, Is.EqualTo(6), "Execute TearDown 3 times"); }
public void RunGenericFixtureWithFilterForOneTestMethod() { GenericTestCounters.ResetCounters(); Type fixtureType = typeof(GenericFixtureWithThreeAttributes <>); MethodInfo testMethod = fixtureType.GetMethod("Success"); Test suite = _suiteBuilder.BuildFrom(fixtureType); TestFilter filter = new SimpleNameFilter( testMethod.ReflectedType.FullName + "." + testMethod.Name); TestResult testResult = suite.Run(NullListener.NULL, filter); Assert.That(testResult.IsSuccess, "All tests are successful."); Assert.That(GenericTestCounters.Test.Value, Is.EqualTo(3), "Executed 3 tests"); Assert.That(GenericTestCounters.SetUp.Value, Is.EqualTo(3), "Execute SetUp 3 times"); Assert.That(GenericTestCounters.TearDown.Value, Is.EqualTo(3), "Execute TearDown 3 times"); }