Ejemplo n.º 1
0
        public void FixtureWithNoTestsShouldNotCallFixtureSetUpOrTearDown()
        {
            FixtureWithNoTests fixture = new FixtureWithNoTests();

            RunTestOnFixture(fixture);
            Assert.IsFalse(fixture.setupCalled, "TestFixtureSetUp called running fixture");
            Assert.IsFalse(fixture.teardownCalled, "TestFixtureTearDown called running fixture");
        }
Ejemplo n.º 2
0
        public void FixtureWithNoTestsShouldNotCallFixtureSetUpOrTearDown()
        {
            FixtureWithNoTests fixture = new FixtureWithNoTests();

            TestBuilder.RunTestFixture(fixture);

            Assert.That(fixture.setupCalled, Is.False, "OneTimeSetUp should not be called for a fixture with no tests");
            Assert.That(fixture.teardownCalled, Is.False, "OneTimeTearDown should not be called for a fixture with no tests");
        }
Ejemplo n.º 3
0
        public void FixtureWithNoTestsCallsFixtureSetUpAndTearDown()
        {
            // NOTE: Beginning with NUnit 2.5.3, FixtureSetUp and TearDown
            // are called even if the fixture contains no tests.

            FixtureWithNoTests fixture = new FixtureWithNoTests();

            RunTestOnFixture(fixture);
            Assert.IsTrue(fixture.setupCalled, "TestFixtureSetUp not called");
            Assert.IsTrue(fixture.teardownCalled, "TestFixtureTearDown not called");
        }
Ejemplo n.º 4
0
        public void FixtureWithNoTestsShouldNotCallFixtureSetUpOrTearDown()
        {
            FixtureWithNoTests testFixture = new FixtureWithNoTests();
            TestSuite          suite       = new TestSuite("NoTestsFixtureSuite");

            suite.Add(testFixture);
            TestSuite fixtureSuite = (TestSuite)suite.Tests[0];

            fixtureSuite.Run(NullListener.NULL);
            Assert.IsFalse(testFixture.setupCalled, "TestFixtureSetUp called running fixture");
            Assert.IsFalse(testFixture.teardownCalled, "TestFixtureTearDown called running fixture");

            suite.Run(NullListener.NULL);
            Assert.IsFalse(testFixture.setupCalled, "TestFixtureSetUp called running enclosing suite");
            Assert.IsFalse(testFixture.teardownCalled, "TestFixtureTearDown called running enclosing suite");
        }