本文整理汇总了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());
}