Esempio n. 1
0
        public void XlsImport2()
        {
            List <Import2Model> data;

            using (var ifile = new XlsImportFile("Data\\XlsImport1.xlsx")) {
                var imp = new Importer <Import2Model>(ifile);
                data = imp.Import().ToList();
            }

            var expectedData = new Import2Model[] {
                new Import2Model {
                    SVal = "abcde", IVal = 1, FVal = 1.5f, DVal = 2.0000001d, DecVal = 3.4m
                },
                new Import2Model {
                    SVal = "xyz,abc", IVal = 2, FVal = 3, DVal = 2, DecVal = 5
                },
                new Import2Model {
                    SVal = null, IVal = null, FVal = null, DVal = null, DecVal = null
                },
                new Import2Model {
                    SVal = "a\r\nb", IVal = null, FVal = 1, DVal = 2, DecVal = 3
                }
            }.ToList();

            CollectionAssert.AreEqual(expectedData, data);
        }
Esempio n. 2
0
 public bool Equals(Import2Model other)
 {
     if (string.IsNullOrEmpty(SVal) && string.IsNullOrEmpty(other.SVal))
     {
         return(true);
     }
     return(((string.IsNullOrEmpty(SVal) && string.IsNullOrEmpty(other.SVal)) || SVal == other.SVal) && IVal == other.IVal && FVal == other.FVal && DVal == other.DVal && DecVal == other.DecVal);
 }