本文整理汇总了C#中NUnit.Framework.TestContext.LoadFixture方法的典型用法代码示例。如果您正苦于以下问题:C# TestContext.LoadFixture方法的具体用法?C# TestContext.LoadFixture怎么用?C# TestContext.LoadFixture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NUnit.Framework.TestContext
的用法示例。
在下文中一共展示了TestContext.LoadFixture方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: throw_argument_not_null_exception_when_the_log_action_is_null
public void throw_argument_not_null_exception_when_the_log_action_is_null()
{
var fixture = MockRepository.GenerateMock<IFixture>();
var context = new TestContext();
context.LoadFixture(fixture, null);
}
示例3: load_fixture_directly_and_find_object_off_of_it
public void load_fixture_directly_and_find_object_off_of_it()
{
var context = new TestContext();
context.LoadFixture(new SomethingElseFixture(), new StubTestPart());
context.FindGrammar("Go").ShouldBeOfType<ValueCheckMethod>();
}
示例4: log_exception_from_section_setup
public void log_exception_from_section_setup()
{
var fixture = MockRepository.GenerateMock<IFixture>();
var context = new TestContext();
var exception = new NotImplementedException();
fixture.Expect(x => x.SetUp(context)).Throw(exception);
var step = new Step();
context.LoadFixture(fixture, step);
context.Counts.Exceptions.ShouldEqual(1);
context.ResultsFor(step).ExceptionText.ShouldContain(exception.ToString());
}
示例5: 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>();
}
示例6: ending_a_section_should_tell_the_previous_fixture_to_finish
public void ending_a_section_should_tell_the_previous_fixture_to_finish()
{
var fixture1 = MockRepository.GenerateMock<IFixture>();
var context = new TestContext();
context.LoadFixture(fixture1, new StubTestPart());
((ITestVisitor)context).EndSection(new Section("something"));
fixture1.AssertWasCalled(x => x.TearDown());
}
示例7: 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());
}
示例8: catch_the_storyteller_exception_on_grammar_adds_exception_count_and_exception_message_only
public void catch_the_storyteller_exception_on_grammar_adds_exception_count_and_exception_message_only()
{
var step = new Step("the step");
var grammar = new GrammarThatAssertsFailure();
var fixture = MockRepository.GenerateMock<IFixture>();
fixture.Stub(x => x[step.GrammarKey]).Return(grammar);
var context = new TestContext();
context.LoadFixture(fixture, new StubTestPart());
context.RunStep(step);
context.Counts.ShouldEqual(0, 0, 1, 0);
context.ResultsFor(step).ExceptionText.ShouldEqual("I don't want to run");
}
示例9: call_fixture_setup_when_loading_a_fixture
public void call_fixture_setup_when_loading_a_fixture()
{
var fixture = MockRepository.GenerateMock<IFixture>();
var context = new TestContext();
context.LoadFixture(fixture, new StubTestPart());
fixture.AssertWasCalled(x => x.SetUp(context));
}