本文整理汇总了C#中StoryTeller.Engine.TestContext.SetupMockGrammar方法的典型用法代码示例。如果您正苦于以下问题:C# TestContext.SetupMockGrammar方法的具体用法?C# TestContext.SetupMockGrammar怎么用?C# TestContext.SetupMockGrammar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StoryTeller.Engine.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));
}
示例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));
}
示例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");
}