本文整理汇总了C#中StoryTeller.Engine.TestContext.ResultsFor方法的典型用法代码示例。如果您正苦于以下问题:C# TestContext.ResultsFor方法的具体用法?C# TestContext.ResultsFor怎么用?C# TestContext.ResultsFor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StoryTeller.Engine.TestContext
的用法示例。
在下文中一共展示了TestContext.ResultsFor方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
grammar =
Fixture.VerifyStringList(() => { throw new NotImplementedException(); }).Titled(
"The list of strings should be").LeafNameIs("row").Grammar();
step = new Step("anything").WithChildren("row", new Step(), new Step(), new Step());
var context = new TestContext();
grammar.Execute(step, context);
counts = context.Counts;
rowResults = context.ResultsFor(step).GetResult<IList<SetRow>>(grammar.LeafName);
stepResults = context.ResultsFor(step);
}
示例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: 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());
}
示例4: 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");
}
示例5: 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");
}
示例6: SetUp
public void SetUp()
{
step = new Step("a").With("key1", "abc");
cell = new Cell("key1", typeof (int));
var context = new TestContext();
cell.ReadArgument(context, step, x => Assert.Fail("should not have called me"));
counts = context.Counts;
results = context.ResultsFor(step);
}
示例7: record_actual_stores_the_data
public void record_actual_stores_the_data()
{
MethodInfo method = ReflectionHelper.GetMethod<CellTarget>(x => x.Add(0, 0));
Step step = new Step("a").With("returnValue", "10");
Cell cell = method.GetReturnCell();
var data = new TestContext();
cell.RecordActual(32.0, step, data);
data.ResultsFor(step).ActualDisplay<double>("returnValue").ShouldEqual(32);
}
示例8: record_actual_calls_mark_missing_value_when_the_expected_value_is_missing
public void record_actual_calls_mark_missing_value_when_the_expected_value_is_missing()
{
MethodInfo method = ReflectionHelper.GetMethod<CellTarget>(x => x.Add(0, 0));
Cell cell = method.GetReturnCell();
var step = new Step();
var data = new TestContext();
cell.RecordActual(32.0, step, data);
data.ResultsFor(step).GetActual("returnValue").ShouldEqual(32.0);
data.Counts.SyntaxErrors.ShouldEqual(1);
}
示例9: read_expected_value_from_step_that_is_boolean_missing_and_input_should_still_log_error
public void read_expected_value_from_step_that_is_boolean_missing_and_input_should_still_log_error()
{
var cell = new Cell("success", typeof (bool))
{
IsResult = false
};
var step = new Step();
var context = new TestContext();
cell.ReadArgument(context, step, o => Assert.Fail("should not have called back"));
context.ResultsFor(step).IsInException("success").ShouldBeTrue();
}
示例10: read_expected_value_from_step_for_a_boolean_result_cell
public void read_expected_value_from_step_for_a_boolean_result_cell()
{
var cell = new Cell("success", typeof (bool))
{
IsResult = true
};
bool returnValue = false;
var step = new Step();
var context = new TestContext();
cell.ReadArgument(context, step, o => returnValue = (bool) o);
returnValue.ShouldBeTrue();
context.ResultsFor(step).IsInException("success").ShouldBeFalse();
}
示例11: read_argument_with_a_format_exception
public void read_argument_with_a_format_exception()
{
Step step = new Step("a").With("age", "abc");
var cell = new Cell("age", typeof (int));
var context = new TestContext();
cell.ReadArgument(context, step, x => Assert.Fail("should not have been called"));
context.Counts.SyntaxErrors.ShouldEqual(1);
context.ResultsFor(step).ExceptionText.ShouldContain("Format exception for 'age'");
}
示例12: Execute
public static StepExecutionResult Execute(this IGrammar grammar, IStep step)
{
var context = new TestContext();
grammar.Execute(step, context);
return new StepExecutionResult{
Counts = context.Counts,
Results = context.ResultsFor(step)
};
}