public void TestTokenize2()
        {
            var tokenizer = new FixedLengthTokenizer
            {
                Columns = new[] { new Range(1, 2), new Range(3) }
            };

            var result = tokenizer.Tokenize(" 1Person 1     ");

            Assert.AreEqual(2, result.Count);
            Assert.AreEqual(" 1", result.ReadRawString(0));
            Assert.AreEqual("Person 1     ", result.ReadRawString(1));
        }
Example #2
0
        public void Tokenize_Line_Test()
        {
            var columns = new[] {
                new FixedLengthTokenizer.ColumnDefinition(0, 10),
                new FixedLengthTokenizer.ColumnDefinition(10, 20),
            };

            var tokenizer = new FixedLengthTokenizer(columns);

            var input = new StringBuilder()
                        .AppendLine("Philipp   Wagner    ")
                        .ToString();

            var result = tokenizer.Tokenize(input);

            Assert.AreEqual("Philipp   ", result[0]);
            Assert.AreEqual("Wagner    ", result[1]);
        }