当前位置: 首页>>代码示例>>C#>>正文


C# Mapper.ParseNext方法代码示例

本文整理汇总了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);
 }
开发者ID:qusma,项目名称:NXmlMapper,代码行数:7,代码来源:NXmlMapperTests.cs

示例2: BoolPropertyTrueStringIsParsedAsTrue

 public void BoolPropertyTrueStringIsParsedAsTrue()
 {
     string input = "<TestClass BoolProp=\"true\" /> ";
     var mapper = new Mapper<TestClass>(input);
     TestClass result = mapper.ParseNext();
     Assert.IsTrue(result.BoolProp);
 }
开发者ID:qusma,项目名称:NXmlMapper,代码行数:7,代码来源:NXmlMapperTests.cs

示例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);
        }
开发者ID:qusma,项目名称:NXmlMapper,代码行数:14,代码来源:NXmlMapperTests.cs

示例4: DoublePropertyParsedCorrectly

 public void DoublePropertyParsedCorrectly()
 {
     var mapper = new Mapper<TestClass>(_input, "SampleXml");
     TestClass t = mapper.ParseNext();
     Assert.AreEqual(5.0, t.DoubleProp);
 }
开发者ID:qusma,项目名称:NXmlMapper,代码行数:6,代码来源:NXmlMapperTests.cs

示例5: DecimalPropertyParsedCorrectly

 public void DecimalPropertyParsedCorrectly()
 {
     var mapper = new Mapper<TestClass>(_input, "SampleXml");
     TestClass t = mapper.ParseNext();
     Assert.AreEqual(1.23456789, t.DecimalProp);
 }
开发者ID:qusma,项目名称:NXmlMapper,代码行数:6,代码来源:NXmlMapperTests.cs

示例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);
 }
开发者ID:qusma,项目名称:NXmlMapper,代码行数:6,代码来源:NXmlMapperTests.cs

示例7: NamedElementPropertyParsedCorrectly

 public void NamedElementPropertyParsedCorrectly()
 {
     var mapper = new Mapper<TestClass>(_input, "SampleXml");
     TestClass t = mapper.ParseNext();
     Assert.AreEqual(55, t.PropWithSpecifiedEelementName);
 }
开发者ID:qusma,项目名称:NXmlMapper,代码行数:6,代码来源:NXmlMapperTests.cs

示例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);
 }
开发者ID:qusma,项目名称:NXmlMapper,代码行数:8,代码来源:NXmlMapperTests.cs

示例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);
 }
开发者ID:qusma,项目名称:NXmlMapper,代码行数:7,代码来源:NXmlMapperTests.cs

示例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);
        }
开发者ID:qusma,项目名称:NXmlMapper,代码行数:23,代码来源:NXmlMapperTests.cs

示例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);
 }
开发者ID:qusma,项目名称:NXmlMapper,代码行数:8,代码来源:NXmlMapperTests.cs

示例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);
 }
开发者ID:qusma,项目名称:NXmlMapper,代码行数:7,代码来源:NXmlMapperTests.cs

示例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);
 }
开发者ID:qusma,项目名称:NXmlMapper,代码行数:7,代码来源:NXmlMapperTests.cs

示例14: NotXmlMappedAttributeStopsMapping

 public void NotXmlMappedAttributeStopsMapping()
 {
     var mapper = new Mapper<TestClass>(_input, "SampleXml");
     TestClass t = mapper.ParseNext();
     Assert.AreEqual(0, t.NotMapped);
 }
开发者ID:qusma,项目名称:NXmlMapper,代码行数:6,代码来源:NXmlMapperTests.cs

示例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);
 }
开发者ID:qusma,项目名称:NXmlMapper,代码行数:8,代码来源:NXmlMapperTests.cs


注:本文中的Mapper.ParseNext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。