示例#1
0
        public void testCSVPipeNormal1()
        {

            var _Pipe = new CSVReaderPipe(ExpectedNumberOfColumns:    5,
                                          FailOnWrongNumberOfColumns: true,
                                          IEnumerable: new List<String>() {
                                                           "#Id,Name,Verb,Help,Action",
                                                           "0,Alice,loves,to,read",
                                                           "1,Bob,likes,to,ski"
                                                       });

            var _Counter = 0;
            while (_Pipe.MoveNext())
            {
                Assert.IsTrue(_Pipe.Current[1] == "Alice" | _Pipe.Current[1] == "Bob");
                _Counter++;
            }

            Assert.AreEqual(_Counter, 2);

        }
示例#2
0
        public void testCSVPipeNormal3()
        {

            var _Pipe = new CSVReaderPipe(StringSplitOptions: StringSplitOptions.RemoveEmptyEntries,
                                          IEnumerable:        new List<String>() {
                                                                  "#Id,Name,Friendlist",
                                                                  "    0,Alice,   a,,b,c, ,d,e     ,f,g   ",
                                                                  "",
                                                                  ",",
                                                                  "1,Bob,a,g,h"
                                                              });

            var _Counter = 0;
            while (_Pipe.MoveNext())
            {
                Assert.IsTrue(_Pipe.Current[1] == "Alice" | _Pipe.Current[1] == "Bob");
                Assert.IsTrue(_Pipe.Current[3] == "b"     | _Pipe.Current[3] == "g");
                _Counter++;
            }

            Assert.AreEqual(_Counter, 2);

        }