本文整理汇总了C#中Field.Read方法的典型用法代码示例。如果您正苦于以下问题:C# Field.Read方法的具体用法?C# Field.Read怎么用?C# Field.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Field
的用法示例。
在下文中一共展示了Field.Read方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: default_field_formatter_is_direct
public void default_field_formatter_is_direct()
{
var field = new Field("teste", "number(6)", null);
var bag = new ValueBag();
field.Read(new StringWalker("123"), bag);
bag["teste"].Formatter.Should().Be.OfType<DirectFormatter>();
}
示例2: can_create_field_with_null_formatter
public void can_create_field_with_null_formatter()
{
var field = new Field("teste", "number(6)", "null");
var bag = new ValueBag();
field.Read(new StringWalker("123"), bag);
bag["teste"].Formatter.Should().Be.OfType<NullFormatter>();
}
示例3: field_of_datetime_format_culture
public void field_of_datetime_format_culture()
{
var field = new Field("teste", "date(HH-dd/MM/yyyy)", "string(ddMMyyyyHH)");
var bag = new ValueBag();
field.Read(new StringWalker("22-15/01/2009"), bag);
bag["teste"].Value.Should().Be(new DateTime(2009, 1, 15, 22, 0, 0));
bag["teste"].Format().Should().Be("1501200922");
}
示例4: field_of_int_format_culture
public void field_of_int_format_culture()
{
var field = new Field("teste", "number(6,1)", "string(F3,pt-br)");
var bag = new ValueBag();
field.Read(new StringWalker("12345678"), bag);
bag.GetAs<decimal>("teste").Should().Be(123456.7m);
bag["teste"].Value.Should().Be(123456.7m);
bag["teste"].Format().Should().Be("123456,700");
}
示例5: field_of_constant_datetime_format_culture
public void field_of_constant_datetime_format_culture()
{
var field = new Field("teste", "constant(2009-11-25, date)", "string(dd/MM/yyyy)");
var bag = new ValueBag();
var str = new StringWalker("12345678");
field.Read(str, bag);
bag["teste"].Value.Should().Be(new DateTime(2009, 11, 25));
bag["teste"].Format().Should().Be("25/11/2009");
}
示例6: field_of_int_format_direct
public void field_of_int_format_direct()
{
var field = new Field("teste", "number(6)", null);
var bag = new ValueBag();
field.Read(new StringWalker("1234567"), bag);
bag.GetAs<decimal>("teste").Should().Be(123456m);
bag["teste"].Value.Should().Be(123456);
bag["teste"].Format().Should().Be(123456);
}