本文整理汇总了C#中Cell.ReadArgument方法的典型用法代码示例。如果您正苦于以下问题:C# Cell.ReadArgument方法的具体用法?C# Cell.ReadArgument怎么用?C# Cell.ReadArgument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cell
的用法示例。
在下文中一共展示了Cell.ReadArgument方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: use_the_default_value_if_the_main_value_is_missing_and_the_cell_is_numeric
public void use_the_default_value_if_the_main_value_is_missing_and_the_cell_is_numeric()
{
var cell = new Cell("key1", typeof (int), "34");
int value = 0;
cell.ReadArgument(new TestContext(), new Step(), x => value = (int) x);
value.ShouldEqual(34);
}
示例3: set_argument_if_the_argument_is_not_simple_pulls_that_argument_from_testcontext
public void set_argument_if_the_argument_is_not_simple_pulls_that_argument_from_testcontext()
{
var cell = new Cell("address", typeof (Address));
var context = new TestContext();
var address = new Address();
context.Store(address);
object argValue = null;
cell.ReadArgument(context, new Step(), x => argValue = x);
argValue.ShouldBeTheSameAs(address);
}
示例4: use_the_default_value_if_the_main_value_is_missing
public void use_the_default_value_if_the_main_value_is_missing()
{
var cell = new Cell("key1", typeof (string), "Jeremy");
string value = null;
cell.ReadArgument(new TestContext(), new Step(), x => value = (string) x);
value.ShouldEqual("Jeremy");
}
示例5: read_null_in_from_a_nullable_type_with_NULL
public void read_null_in_from_a_nullable_type_with_NULL()
{
Step step = new Step("a").With("age", "NULL");
var cell = new Cell("age", typeof (int?));
var context = new TestContext();
int? returnValue = 3;
cell.ReadArgument(context, step, x => returnValue = (int?) x);
returnValue.HasValue.ShouldBeFalse();
}
示例6: set_argument_if_argument_is_itestcontext_just_uses_the_itestcontext
public void set_argument_if_argument_is_itestcontext_just_uses_the_itestcontext()
{
var cell = new Cell("context", typeof (ITestContext));
var context = new TestContext();
object argValue = null;
cell.ReadArgument(context, new Step(), x => argValue = x);
argValue.ShouldBeTheSameAs(context);
}
示例7: read_non_null_data_in_for_a_nullable_type
public void read_non_null_data_in_for_a_nullable_type()
{
Step step = new Step("a").With("age", "34");
var cell = new Cell("age", typeof (int?));
var context = new TestContext();
int? returnValue = null;
cell.ReadArgument(context, step, x => returnValue = (int?) x);
returnValue.Value.ShouldEqual(34);
}
示例8: read_in_DateTime
public void read_in_DateTime()
{
Step step = new Step("a").With("day", "1/1/2009");
var cell = new Cell("day", typeof (DateTime));
var context = new TestContext();
DateTime returnValue = DateTime.Today;
cell.ReadArgument(context, step, x => returnValue = (DateTime) x);
returnValue.ShouldEqual(new DateTime(2009, 1, 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'");
}