本文整理匯總了C#中NUnit.Framework.TestContext.RevertFixture方法的典型用法代碼示例。如果您正苦於以下問題:C# TestContext.RevertFixture方法的具體用法?C# TestContext.RevertFixture怎麽用?C# TestContext.RevertFixture使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類NUnit.Framework.TestContext
的用法示例。
在下文中一共展示了TestContext.RevertFixture方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: load_and_revert_fixtures
public void load_and_revert_fixtures()
{
var context = new TestContext();
context.LoadFixture<ArithmeticFixture>(new StubTestPart());
context.CurrentFixture.ShouldBeOfType<ArithmeticFixture>();
context.LoadFixture<SomethingFixture>(new StubTestPart());
context.CurrentFixture.ShouldBeOfType<SomethingFixture>();
context.RevertFixture(new StubTestPart());
context.CurrentFixture.ShouldBeOfType<ArithmeticFixture>();
}
示例2: reverting_a_fixture_with_an_exception_in_teardown_increments_exceptions_and_captures_the_exception
public void reverting_a_fixture_with_an_exception_in_teardown_increments_exceptions_and_captures_the_exception()
{
var fixture = MockRepository.GenerateMock<IFixture>();
var exception = new NotImplementedException();
fixture.Expect(x => x.TearDown()).Throw(exception);
var context = new TestContext();
var section = new Section("something");
context.LoadFixture(fixture, section);
context.RevertFixture(section);
context.ResultsFor(section).ExceptionText.ShouldEqual(exception.ToString());
context.Counts.Exceptions.ShouldEqual(1);
}
示例3: context_should_tell_a_fixture_that_it_is_finished_at_the_end
public void context_should_tell_a_fixture_that_it_is_finished_at_the_end()
{
var fixture1 = MockRepository.GenerateMock<IFixture>();
var fixture2 = MockRepository.GenerateMock<IFixture>();
var context = new TestContext();
context.LoadFixture(fixture1, new StubTestPart());
fixture1.AssertWasNotCalled(x => x.TearDown());
context.LoadFixture(fixture2, new StubTestPart());
fixture1.AssertWasNotCalled(x => x.TearDown());
fixture2.AssertWasNotCalled(x => x.TearDown());
context.RevertFixture(new StubTestPart());
fixture1.AssertWasNotCalled(x => x.TearDown());
fixture2.AssertWasCalled(x => x.TearDown());
context.RevertFixture(new StubTestPart());
fixture1.AssertWasCalled(x => x.TearDown());
}