示例#1
0
        public void SplitLine_NullField_NullValue()
        {
            var reader = new CsvReaderProxy();
            var values = reader.SplitLine("a;(null)", ';', char.MinValue, char.MinValue, string.Empty);

            Assert.That(values.ElementAt(1), Is.Null);
        }
示例#2
0
        public void SplitLine_RecordWithThreeFields_CorrectParsing(string record, string thirdToken)
        {
            var reader = new CsvReaderProxy();
            var values = reader.SplitLine(record, ';', '\'', '\'', string.Empty).ToList();

            Assert.That(values[2], Is.EqualTo(thirdToken));
        }
示例#3
0
        public void SplitLine_RecordWithTwoFields_CorrectParsing(string record, string firstToken)
        {
            var reader = new CsvReaderProxy();
            var values = reader.SplitLine(record, ';', '\'', '\'', string.Empty).ToList();

            Assert.That(values[0], Is.EqualTo(firstToken));
            Assert.That(values[1], Is.EqualTo("xyz"));
        }
示例#4
0
        public void SplitLine_RecordWithUnescapedTextQualifier_ThrowException(string record)
        {
            var reader = new CsvReaderProxy();

            Assert.Throws <ArgumentException>(() => reader.SplitLine(record, ';', '\'', '\'', string.Empty).ToList());
        }