当前位置: 首页>>代码示例>>C#>>正文


C# TestContext.LoadFixture方法代码示例

本文整理汇总了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);
        }
开发者ID:adymitruk,项目名称:storyteller,代码行数:16,代码来源:TestContextTester.cs

示例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);
 }
开发者ID:adymitruk,项目名称:storyteller,代码行数:6,代码来源:TestContextTester.cs

示例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>();
        }
开发者ID:adymitruk,项目名称:storyteller,代码行数:8,代码来源:TestContextTester.cs

示例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());
        }
开发者ID:adymitruk,项目名称:storyteller,代码行数:14,代码来源:TestContextTester.cs

示例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>();
        }
开发者ID:adymitruk,项目名称:storyteller,代码行数:14,代码来源:TestContextTester.cs

示例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());
        }
开发者ID:adymitruk,项目名称:storyteller,代码行数:10,代码来源:TestContextTester.cs

示例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());
        }
开发者ID:adymitruk,项目名称:storyteller,代码行数:20,代码来源:TestContextTester.cs

示例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");
        }
开发者ID:adymitruk,项目名称:storyteller,代码行数:17,代码来源:TestContextTester.cs

示例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));
        }
开发者ID:adymitruk,项目名称:storyteller,代码行数:8,代码来源:TestContextTester.cs


注:本文中的NUnit.Framework.TestContext.LoadFixture方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。