public void RunTestByName() { TestSuite testSuite = new TestSuite("Mock Test Suite"); testSuite.Add(mockTestFixture); Assert.IsNull(testSuite.Parent); Test firstTest = (Test)testSuite.Tests[0]; Assert.AreEqual(testSuite, firstTest.Parent); Assert.AreEqual("Mock Test Suite", testSuite.TestPath); Assert.AreEqual("Mock Test SuiteNUnit.Tests.Assemblies.MockTestFixture", firstTest.TestPath); Assert.IsTrue(firstTest.IsDescendant(testSuite), "test should be a descendant of suite"); Test bottom = (Test)firstTest.Tests[2]; Assert.IsTrue(bottom.IsDescendant(firstTest)); Assert.IsTrue(bottom.IsDescendant(testSuite)); RecordingListener listener = new RecordingListener(); NameFilter filter = new NameFilter(bottom); testSuite.Run(listener, filter); Assert.AreEqual(1, listener.testStarted.Count); Assert.AreEqual("MockTest3", (string)listener.testStarted[0]); }
public void RunSingleTest() { TestFixture fixture = new TestFixture(typeof(NUnit.Tests.Assemblies.MockTestFixture)); Test test = (Test)fixture.Tests[0]; RecordingListener listener = new RecordingListener(); test.Run(listener, null); Assert.IsFalse(listener.lastResult.IsFailure); }
public void RunSuiteByName() { TestSuite testSuite = new TestSuite("Mock Test Suite"); testSuite.Add(mockTestFixture); RecordingListener listener = new RecordingListener(); testSuite.Run(listener); Assert.AreEqual(MockTestFixture.Tests, listener.testStarted.Count); Assert.AreEqual(2, listener.suiteStarted.Count); }
public void RunSuiteByCategory() { TestSuite testSuite = new TestSuite("Mock Test Suite"); testSuite.Add(mockTestFixture); CategoryFilter filter = new CategoryFilter(); filter.AddCategory("FixtureCategory"); RecordingListener listener = new RecordingListener(); testSuite.Run(listener, filter); Assert.AreEqual(MockTestFixture.Tests, listener.testStarted.Count); }
public void RunTestByCategory() { TestSuite testSuite = new TestSuite("Mock Test Suite"); testSuite.Add(mockTestFixture); CategoryFilter filter = new CategoryFilter(); filter.AddCategory("MockCategory"); RecordingListener listener = new RecordingListener(); testSuite.Run(listener, filter); Assert.AreEqual(2, listener.testStarted.Count); Assert.IsTrue(listener.testStarted.Contains("MockTest2")); Assert.IsTrue(listener.testStarted.Contains("MockTest3")); }