Exemple #1
0
 public void EdifactStreamReaderTest_Read_All2()
 {
     var reader = new EdifactStreamReader();
       using (var sr = File.OpenText(TestData.GetTestFilePath(TestData.SampleFile2Name)))
       {
     var model = reader.Read(sr);
     Assert.AreEqual<int>(15, model.Segments.Count);
       }
 }
Exemple #2
0
        public void EdifactStreamReaderTest_Read_All2()
        {
            var reader = new EdifactStreamReader();

            using (var sr = File.OpenText(TestData.GetTestFilePath(TestData.SampleFile2Name)))
            {
                var model = reader.Read(sr);
                Assert.AreEqual <int>(15, model.Segments.Count);
            }
        }
Exemple #3
0
        public void EdifactStreamReaderTest_Read_All()
        {
            var reader = new EdifactStreamReader();

            using (var sr = File.OpenText(TestData.GetTestFilePath()))
            {
                var model = reader.Read(sr);
                Assert.AreEqual <int>(15, model.Segments.Count);
                int i = 0;
                Assert.AreEqual <string>("UNB", model.Segments[i].SegmentType);
                Assert.AreEqual <int>(5, model.Segments[i++].DataElements.Count);

                Assert.AreEqual <string>("UNH", model.Segments[i].SegmentType);
                Assert.AreEqual <int>(2, model.Segments[i++].DataElements.Count);

                Assert.AreEqual <string>("MSG", model.Segments[i].SegmentType);
                Assert.AreEqual <int>(1, model.Segments[i++].DataElements.Count);

                Assert.AreEqual <string>("IFT", model.Segments[i].SegmentType);
                Assert.AreEqual <int>(2, model.Segments[i++].DataElements.Count);

                Assert.AreEqual <string>("ERC", model.Segments[i].SegmentType);
                Assert.AreEqual <int>(1, model.Segments[i++].DataElements.Count);

                Assert.AreEqual <string>("IFT", model.Segments[i].SegmentType);
                Assert.AreEqual <int>(2, model.Segments[i++].DataElements.Count);

                Assert.AreEqual <string>("ODI", model.Segments[i].SegmentType);
                Assert.AreEqual <int>(0, model.Segments[i++].DataElements.Count);

                Assert.AreEqual <string>("TVL", model.Segments[i].SegmentType);
                Assert.AreEqual <int>(6, model.Segments[i++].DataElements.Count);

                Assert.AreEqual <string>("PDI", model.Segments[i].SegmentType);
                Assert.AreEqual <int>(4, model.Segments[i++].DataElements.Count);

                Assert.AreEqual <string>("APD", model.Segments[i].SegmentType);
                Assert.AreEqual <int>(7, model.Segments[i++].DataElements.Count);

                Assert.AreEqual <string>("TVL", model.Segments[i].SegmentType);
                Assert.AreEqual <int>(6, model.Segments[i++].DataElements.Count);

                Assert.AreEqual <string>("PDI", model.Segments[i].SegmentType);
                Assert.AreEqual <int>(2, model.Segments[i++].DataElements.Count);

                Assert.AreEqual <string>("APD", model.Segments[i].SegmentType);
                Assert.AreEqual <int>(8, model.Segments[i++].DataElements.Count);

                Assert.AreEqual <string>("UNT", model.Segments[i].SegmentType);
                Assert.AreEqual <int>(2, model.Segments[i++].DataElements.Count);

                Assert.AreEqual <string>("UNZ", model.Segments[i].SegmentType);
                Assert.AreEqual <int>(2, model.Segments[i++].DataElements.Count);
            }
        }
Exemple #4
0
        public void EdifactStreamReaderTest_Read_All()
        {
            var reader = new EdifactStreamReader();
              using (var sr = File.OpenText(TestData.GetTestFilePath()))
              {
            var model = reader.Read(sr);
            Assert.AreEqual<int>(15, model.Segments.Count);
            int i = 0;
            Assert.AreEqual<string>("UNB", model.Segments[i].SegmentType);
            Assert.AreEqual<int>(5, model.Segments[i++].DataElements.Count);

            Assert.AreEqual<string>("UNH", model.Segments[i].SegmentType);
            Assert.AreEqual<int>(2, model.Segments[i++].DataElements.Count);

            Assert.AreEqual<string>("MSG", model.Segments[i].SegmentType);
            Assert.AreEqual<int>(1, model.Segments[i++].DataElements.Count);

            Assert.AreEqual<string>("IFT", model.Segments[i].SegmentType);
            Assert.AreEqual<int>(2, model.Segments[i++].DataElements.Count);

            Assert.AreEqual<string>("ERC", model.Segments[i].SegmentType);
            Assert.AreEqual<int>(1, model.Segments[i++].DataElements.Count);

            Assert.AreEqual<string>("IFT", model.Segments[i].SegmentType);
            Assert.AreEqual<int>(2, model.Segments[i++].DataElements.Count);

            Assert.AreEqual<string>("ODI", model.Segments[i].SegmentType);
            Assert.AreEqual<int>(0, model.Segments[i++].DataElements.Count);

            Assert.AreEqual<string>("TVL", model.Segments[i].SegmentType);
            Assert.AreEqual<int>(6, model.Segments[i++].DataElements.Count);

            Assert.AreEqual<string>("PDI", model.Segments[i].SegmentType);
            Assert.AreEqual<int>(4, model.Segments[i++].DataElements.Count);

            Assert.AreEqual<string>("APD", model.Segments[i].SegmentType);
            Assert.AreEqual<int>(7, model.Segments[i++].DataElements.Count);

            Assert.AreEqual<string>("TVL", model.Segments[i].SegmentType);
            Assert.AreEqual<int>(6, model.Segments[i++].DataElements.Count);

            Assert.AreEqual<string>("PDI", model.Segments[i].SegmentType);
            Assert.AreEqual<int>(2, model.Segments[i++].DataElements.Count);

            Assert.AreEqual<string>("APD", model.Segments[i].SegmentType);
            Assert.AreEqual<int>(8, model.Segments[i++].DataElements.Count);

            Assert.AreEqual<string>("UNT", model.Segments[i].SegmentType);
            Assert.AreEqual<int>(2, model.Segments[i++].DataElements.Count);

            Assert.AreEqual<string>("UNZ", model.Segments[i].SegmentType);
            Assert.AreEqual<int>(2, model.Segments[i++].DataElements.Count);
              }
        }
Exemple #5
0
        public void EdifactStreamReaderTest_Read_UNA()
        {
            var reader = new EdifactStreamReader();

            using (var sr = File.OpenText(TestData.GetTestFilePath()))
            {
                var model = reader.Read(sr);

                Assert.AreEqual <char>(':', model.UNA.ComponentDataElementSeparator);
                Assert.AreEqual <char>('?', model.UNA.ReleaseCharacter);
                Assert.AreEqual <char>('+', model.UNA.SegmentTagDataElementSeparator);
                Assert.AreEqual <char>('\'', model.UNA.SegmentTerminator);
                Assert.AreEqual <char>('.', model.UNA.DecimalNotification);
            }
        }
Exemple #6
0
        public void EdifactStreamWriterTest_Write()
        {
            var writer = new EdifactStreamWriter();
              var sb = new StringBuilder();

              EdifactModel model;
              using (var sr = File.OpenText(TestData.GetTestFilePath(TestData.SampleFile2Name)))
            model = new EdifactStreamReader().Read(sr);

              using (var sw = new StringWriter(sb))
            writer.Write(model, sw);

              string written = sb.ToString();
              string sampleFile2 = File.ReadAllText(TestData.GetTestFilePath(TestData.SampleFile2Name));

              for (int i = 0; i < sampleFile2.Length; i++)
            Assert.AreEqual<char>(sampleFile2[i], written[i],
              string.Format("error at char {0}, should be {1} but is {2}", i, sampleFile2[i], written[i]));
        }
Exemple #7
0
        public void EdifactStreamWriterTest_Write()
        {
            var writer = new EdifactStreamWriter();
            var sb     = new StringBuilder();

            EdifactModel model;

            using (var sr = File.OpenText(TestData.GetTestFilePath(TestData.SampleFile2Name)))
                model = new EdifactStreamReader().Read(sr);

            using (var sw = new StringWriter(sb))
                writer.Write(model, sw);

            string written     = sb.ToString();
            string sampleFile2 = File.ReadAllText(TestData.GetTestFilePath(TestData.SampleFile2Name));

            for (int i = 0; i < sampleFile2.Length; i++)
            {
                Assert.AreEqual <char>(sampleFile2[i], written[i],
                                       string.Format("error at char {0}, should be {1} but is {2}", i, sampleFile2[i], written[i]));
            }
        }
Exemple #8
0
 public void EdifactStreamReaderTest_Ctor()
 {
     var reader = new EdifactStreamReader();
 }
Exemple #9
0
        public void EdifactStreamReaderTest_Read_UNA()
        {
            var reader = new EdifactStreamReader();
              using (var sr = File.OpenText(TestData.GetTestFilePath()))
              {
            var model = reader.Read(sr);

            Assert.AreEqual<char>(':', model.UNA.ComponentDataElementSeparator);
            Assert.AreEqual<char>('?', model.UNA.ReleaseCharacter);
            Assert.AreEqual<char>('+', model.UNA.SegmentTagDataElementSeparator);
            Assert.AreEqual<char>('\'', model.UNA.SegmentTerminator);
            Assert.AreEqual<char>('.', model.UNA.DecimalNotification);
              }
        }
Exemple #10
0
 public void EdifactStreamReaderTest_Ctor()
 {
     var reader = new EdifactStreamReader();
 }