public void MapMultipleTypesTest()
        {
            var config = new CsvConfiguration();

            config.ClassMapping <AMap>();
            config.ClassMapping <BMap>();

            Assert.IsNotNull(config.Maps[typeof(A)]);
            Assert.IsNotNull(config.Maps[typeof(B)]);
        }
        public void AddingMappingsFromClassMapInstance()
        {
            var config = new CsvConfiguration();

            config.ClassMapping(new TestClassMappings());

            Assert.AreEqual(2, config.Properties.Count);
        }
        public void AddingMappingsWithGenericMethod2()
        {
            var config = new CsvConfiguration();

            config.ClassMapping <TestClassMappings>();

            Assert.AreEqual(2, config.Properties.Count);
        }
Esempio n. 4
0
        public void AddingMappingsWithGenericMethod1()
        {
            var config = new CsvConfiguration();

            config.ClassMapping <TestClassMappings>();

            Assert.AreEqual(2, config.Maps[typeof(TestClass)].PropertyMaps.Count);
        }
Esempio n. 5
0
        private static void ReadRecordsTestBody()
        {
            const string source = "DecimalColumn;DateTimeColumn\r\n" +
                                  "12,0;11.11.2010\r\n";

            var configuration = new CsvConfiguration
            {
                Delimiter = ";",
            };

            configuration.ClassMapping <TestRecordWithDecimalMap>();
            var reader = new CsvReader(new CsvParser(new StringReader(source), configuration));

            var records = reader.GetRecords <TestRecordWithDecimal>().ToList();

            Assert.AreEqual(1, records.Count());
            var record = records.First();

            Assert.AreEqual(12.0m, record.DecimalColumn);
            Assert.AreEqual(new DateTime(2010, 11, 11), record.DateTimeColumn);
        }
Esempio n. 6
0
 protected override void SetMapping(CsvConfiguration conf)
 {
     conf.ClassMapping <CriSupportiveCommunitiesCsvMap>();
 }
Esempio n. 7
0
 protected override void SetMapping(CsvConfiguration conf)
 {
     conf.ClassMapping <CriEmergencyCsvMap>();
 }
 protected override void SetMapping(CsvConfiguration conf)
 {
     conf.ClassMapping <CriSoupKitchensCsvMap>();
 }
 protected override void SetMapping(CsvConfiguration conf)
 {
     conf.ClassMapping <CriClientEventsCountCsvMap>();
 }