예제 #1
0
        public void EdifactReader_UNOA_ReadLine_WithNewLine()
        {
            const string value = @"ABC@@@
            XYZ@@@";
             var bytes = Utf8.GetBytes(value);
             var output = new byte[3];

             var sb = new StringBuilder();

             var sr = new EdifactReader(new MemoryStream(bytes), Utf8, EdifactCharacterSet.UNOA, '.');
             var result = sr.ReadLine();

             Assert.AreEqual<string>("ABC...", result);

             result = sr.ReadLine();

             Assert.AreEqual<string>("XYZ...", result);
        }
예제 #2
0
        public void EdifactReader_UNOA_ReadLine()
        {
            const string value = "ABC@@@";
             var bytes = Utf8.GetBytes(value);
             var output = new byte[3];

             var sb = new StringBuilder();

             using (var sr = new EdifactReader(new MemoryStream(bytes), Utf8, EdifactCharacterSet.UNOA, '.'))
             {
                 int c;
                 while ((c = sr.Read()) != -1)
                 {
                     sb.Append((char)c);
                 }

             }

             var resultRead = sb.ToString();

             var sr2 = new EdifactReader(new MemoryStream(bytes), Utf8, EdifactCharacterSet.UNOA, '.');
             var resultReadLine = sr2.ReadLine();

             Assert.AreEqual<string>("ABC...", resultRead);
             Assert.AreEqual<string>("ABC...", resultReadLine);
        }