Beispiel #1
0
        public void create_a_splited_line()
        {
            SplitedLine splitedLine = new SplitedLine("a  simple  test! ", " ");
            var         words       = splitedLine.Words;

            Assert.AreEqual("a  simple  test! ", splitedLine.Origin);
            Assert.AreEqual(" ", splitedLine.Separator);
            Assert.AreEqual(3, splitedLine.WordCount);
            Assert.AreEqual("a", words[0]);
            Assert.AreEqual("simple", words[1]);
            Assert.AreEqual("test!", words[2]);
        }
        public void get_a_limited_splited_line_from_a_splited_line()
        {
            SplitedLine splitedLine        = new SplitedLine(" a        simple   test! ", " ");
            var         limitedSplitedLine = splitedLine.GetLimitedSplitedLine(2);
            var         words = limitedSplitedLine.Words;

            Assert.AreEqual(" a        simple   test! ", limitedSplitedLine.Origin);
            Assert.AreEqual(" ", limitedSplitedLine.Separator);
            Assert.AreEqual(2, limitedSplitedLine.WordCount);
            Assert.AreEqual("a", words[0]);
            Assert.AreEqual("simple   test! ", words[1]);
        }
Beispiel #3
0
 public static LimitedSplitedLine GetLimitedSplitedLine(this SplitedLine splitedLine, int limitedWordCount)
 {
     return(new LimitedSplitedLine(splitedLine.Origin, splitedLine.Separator, limitedWordCount));
 }