當前位置: 首頁>>代碼示例>>C#>>正文


C# TestContext.SetupMockGrammar方法代碼示例

本文整理匯總了C#中NUnit.Framework.TestContext.SetupMockGrammar方法的典型用法代碼示例。如果您正苦於以下問題:C# TestContext.SetupMockGrammar方法的具體用法?C# TestContext.SetupMockGrammar怎麽用?C# TestContext.SetupMockGrammar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NUnit.Framework.TestContext的用法示例。


在下文中一共展示了TestContext.SetupMockGrammar方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: running_a_step_logs_the_start_and_end_of_the_grammar

        public void running_a_step_logs_the_start_and_end_of_the_grammar()
        {
            var step = new Step("the step");

            var listener = MockRepository.GenerateMock<ITestObserver>();
            listener.Expect(x => x.CanContinue(null)).Return(true).IgnoreArguments().Repeat.Any();

            var context = new TestContext(new Container(), new Test("Fake"), listener);
            IGrammar grammar = context.SetupMockGrammar(step.GrammarKey);

            context.RunStep(step);

            listener.AssertWasCalled(x => x.StartStep(step));
            listener.AssertWasCalled(x => x.FinishStep(step));
        }
開發者ID:adymitruk,項目名稱:storyteller,代碼行數:15,代碼來源:TestContextTester.cs

示例2: run_a_step

        public void run_a_step()
        {
            var step = new Step("the step");

            var context = new TestContext();
            IGrammar grammar = context.SetupMockGrammar(step.GrammarKey);

            context.RunStep(step);

            grammar.AssertWasCalled(x => x.Execute(step, context));
        }
開發者ID:adymitruk,項目名稱:storyteller,代碼行數:11,代碼來源:TestContextTester.cs

示例3: catch_all_exception_on_grammar_adds_exception_count_and_exception_text

        public void catch_all_exception_on_grammar_adds_exception_count_and_exception_text()
        {
            var step = new Step("the step");
            var context = new TestContext();
            IGrammar grammar = context.SetupMockGrammar(step.GrammarKey);

            grammar.Expect(x => x.Execute(step, context))
                .Throw(new NotImplementedException());

            context.RunStep(step);

            context.Counts.ShouldEqual(0, 0, 1, 0);

            context.ResultsFor(step).ExceptionText.ShouldContain("NotImplementedException");
        }
開發者ID:adymitruk,項目名稱:storyteller,代碼行數:15,代碼來源:TestContextTester.cs


注:本文中的NUnit.Framework.TestContext.SetupMockGrammar方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。