示例#1
0
        public void GetErrorsTest()
        {
            var cs     = new CsvSerializer <ForDesirializeError>();
            var errors = cs.GetErrors("1000,2000\r\nx,y");

            Assert.AreEqual(4, errors.Count);

            var errorLine1 = errors[0];

            Assert.AreEqual(1, errorLine1.Context.LineNumber);
            Assert.AreEqual(CsvConfig.Current.ValidationMessage.GetPrecisionError(errorLine1.Context, 3), errorLine1.ErrorMessage);

            var errorLine2 = errors[3];

            Assert.AreEqual(2, errorLine2.Context.LineNumber);
            Assert.AreEqual(CsvConfig.Current.ValidationMessage.GetNumericConvertError(errorLine2.Context), errorLine2.ErrorMessage);
        }