コード例 #1
0
        public void SplitTest()
        {
            // Arrange
              var delimiter = ',';
              var line = String.Format("10248{0} 1.10{0} Address X{0} 10/10/2010", delimiter);

              // Act
              var fieldsSplitter = new DelimiterSeparatedValuesFieldsSplitter<Order>(delimiter);
              var actual = fieldsSplitter.Split(line);

              // Assert
              var expected = new string[] { "10248", "1.10", "Address X", "10/10/2010" };
              Assert.IsTrue(expected.SequenceEqual(actual));
        }
コード例 #2
0
        public void SplitDoubleQuotedTextTest()
        {
            // Arrange
              var delimiter = '|';
              var line = String.Format("10248{0}1.0{0}\"Address between double quotes\"{0}10/10/2010", delimiter);

              // Act
              var fieldsSplitter = new DelimiterSeparatedValuesFieldsSplitter<Order>(delimiter);
              var actual = fieldsSplitter.Split(line);

              // Assert
              var expected = new string[] { "10248", "1.0", "Address between double quotes", "10/10/2010" };
              Assert.IsTrue(expected.SequenceEqual(actual));
        }