本文整理汇总了C#中Mapper.ParseNext方法的典型用法代码示例。如果您正苦于以下问题:C# Mapper.ParseNext方法的具体用法?C# Mapper.ParseNext怎么用?C# Mapper.ParseNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mapper
的用法示例。
在下文中一共展示了Mapper.ParseNext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BoolPropertyZeroIsParsedAsFalse
public void BoolPropertyZeroIsParsedAsFalse()
{
string input = "<TestClass BoolProp=\"0\" /> ";
var mapper = new Mapper<TestClass>(input);
TestClass result = mapper.ParseNext();
Assert.IsFalse(result.BoolProp);
}
示例2: BoolPropertyTrueStringIsParsedAsTrue
public void BoolPropertyTrueStringIsParsedAsTrue()
{
string input = "<TestClass BoolProp=\"true\" /> ";
var mapper = new Mapper<TestClass>(input);
TestClass result = mapper.ParseNext();
Assert.IsTrue(result.BoolProp);
}
示例3: ElementValueAndAttributeWithSameNameAreParsedCorrectly
public void ElementValueAndAttributeWithSameNameAreParsedCorrectly()
{
string input = "<TestClass TestElement=\"1\">" +
"<TestElement>2</TestElement>" +
"</TestClass>";
var mapper = new Mapper<TestClass>(input);
mapper.SetAttributeMap("TestElement", "DoubleProp");
mapper.SetElementMap("TestElement", "DecimalProp");
TestClass result = mapper.ParseNext();
Assert.AreEqual(1, result.DoubleProp);
Assert.AreEqual(2, result.DecimalProp);
}
示例4: DoublePropertyParsedCorrectly
public void DoublePropertyParsedCorrectly()
{
var mapper = new Mapper<TestClass>(_input, "SampleXml");
TestClass t = mapper.ParseNext();
Assert.AreEqual(5.0, t.DoubleProp);
}
示例5: DecimalPropertyParsedCorrectly
public void DecimalPropertyParsedCorrectly()
{
var mapper = new Mapper<TestClass>(_input, "SampleXml");
TestClass t = mapper.ParseNext();
Assert.AreEqual(1.23456789, t.DecimalProp);
}
示例6: DateTimeParsingWorksCorrectly
public void DateTimeParsingWorksCorrectly()
{
var mapper = new Mapper<TestClass>(_input, "SampleXml");
TestClass t = mapper.ParseNext();
Assert.AreEqual(new DateTime(2001, 11, 16), t.Date);
}
示例7: NamedElementPropertyParsedCorrectly
public void NamedElementPropertyParsedCorrectly()
{
var mapper = new Mapper<TestClass>(_input, "SampleXml");
TestClass t = mapper.ParseNext();
Assert.AreEqual(55, t.PropWithSpecifiedEelementName);
}
示例8: ParseOptionsOnElementValuesWorkCorrectly
public void ParseOptionsOnElementValuesWorkCorrectly()
{
string input = "<TestClass> <WeirdDate>2001-05;17</WeirdDate> </TestClass>";
var mapper = new Mapper<TestClass>(input);
mapper.SetElementMap("WeirdDate", "Date", "yyyy-MM;dd");
TestClass t = mapper.ParseNext();
Assert.AreEqual(new DateTime(2001, 05, 17), t.Date);
}
示例9: PropertyUsedWithSetAttributeMapParsedCorrectly
public void PropertyUsedWithSetAttributeMapParsedCorrectly()
{
var mapper = new Mapper<TestClass>(_input, "SampleXml");
mapper.SetAttributeMap("BarFoo", "FooBar");
TestClass t = mapper.ParseNext();
Assert.AreEqual(1, t.FooBar);
}
示例10: ParseNextStepsThroughTheCollectionCorrectly
public void ParseNextStepsThroughTheCollectionCorrectly()
{
string input = "<Collection>" +
"<TestClass IntProp=\"0\" /> " +
"<TestClass IntProp=\"1\" /> " +
"<TestClass IntProp=\"2\" /> " +
"<TestClass IntProp=\"3\" /> " +
"</Collection>";
var mapper = new Mapper<TestClass>(input);
TestClass result = mapper.ParseNext();
Assert.AreEqual(0, result.IntProp);
result = mapper.ParseNext();
Assert.AreEqual(1, result.IntProp);
result = mapper.ParseNext();
Assert.AreEqual(2, result.IntProp);
result = mapper.ParseNext();
Assert.AreEqual(3, result.IntProp);
}
示例11: ParseOptionsOnAttributeValuesWorkCorrectly
public void ParseOptionsOnAttributeValuesWorkCorrectly()
{
string input = "<TestClass WeirdDate=\"2001-05;17\" />";
var mapper = new Mapper<TestClass>(input);
mapper.SetAttributeMap("WeirdDate", "Date", "yyyy-MM;dd");
TestClass t = mapper.ParseNext();
Assert.AreEqual(new DateTime(2001, 05, 17), t.Date);
}
示例12: NullableDoubleParsingWorksWhenValueIsNumber
public void NullableDoubleParsingWorksWhenValueIsNumber()
{
string input = "<TestClass NullableDoubleProp=\"0.05\" /> ";
var mapper = new Mapper<TestClass>(input);
TestClass result = mapper.ParseNext();
Assert.AreEqual(0.05, result.NullableDoubleProp);
}
示例13: NullableDoubleParsingReturnsNullWhenParsingDoesNotWork
public void NullableDoubleParsingReturnsNullWhenParsingDoesNotWork()
{
string input = "<TestClass NullableDoubleProp=\"asdf\" /> ";
var mapper = new Mapper<TestClass>(input);
TestClass result = mapper.ParseNext();
Assert.AreEqual(null, result.NullableDoubleProp);
}
示例14: NotXmlMappedAttributeStopsMapping
public void NotXmlMappedAttributeStopsMapping()
{
var mapper = new Mapper<TestClass>(_input, "SampleXml");
TestClass t = mapper.ParseNext();
Assert.AreEqual(0, t.NotMapped);
}
示例15: FluentAttributeMappingWorksCorrectly
public void FluentAttributeMappingWorksCorrectly()
{
string input = "<TestClass TestAttr=\"5\" /> ";
var mapper = new Mapper<TestClass>(input);
mapper.SetAttributeMap("TestAttr", x => x.DoubleProp);
TestClass result = mapper.ParseNext();
Assert.AreEqual(null, result.NullableDoubleProp);
}