Пример #1
0
        public void StringifyingAComponentContainingASpecificSeparator()
        {
            var component = new EdiComponent("a>b");
            var options   = new EdiOptions {
                ComponentSeparator = '>'
            };

            Assert.AreEqual("a>b", component.ToString(options));
        }
Пример #2
0
        public void ConvertingAnElementToAStringWithSpecificSeparators()
        {
            var element = new EdiElement();
            element.Repetitions.Add(new EdiRepetition("1234"));
            element.Repetitions.Add(new EdiRepetition("5678"));
            var options = new EdiOptions {RepetitionSeparator = '^'};

            Assert.AreEqual("1234^5678", element.ToString(options));
        }
Пример #3
0
        public void ConvertingARepetitionToAStringWithSpecificSeparators()
        {
            var repetition = new EdiRepetition();
            repetition[02] = "1234";
            repetition[04] = "5678";
            var options = new EdiOptions {ComponentSeparator = '<'};

            Assert.AreEqual("<1234<<5678", repetition.ToString(options));
        }
Пример #4
0
        public void ConvertingASegmentToAStringWithSpecificSeparators()
        {
            var segment = new EdiSegment("SEG");
            segment[02] = "1234";
            segment[04] = "5678";
            var options = new EdiOptions {SegmentTerminator = '~'};

            Assert.AreEqual("SEG**1234**5678~", segment.ToString(options));
        }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the EdiOptions class with values copied from the specified EdiOptions parameter.
 /// </summary>
 /// <param name="source">An EdiOptions containing values to copy.</param>
 public EdiOptions(EdiOptions source)
 {
     SegmentTerminator = source.SegmentTerminator;
     ElementSeparator = source.ElementSeparator;
     ComponentSeparator = source.ComponentSeparator;
     RepetitionSeparator = source.RepetitionSeparator;
     DecimalIndicator = source.DecimalIndicator;
     ReleaseCharacter = source.ReleaseCharacter;
     AddLineBreaks = source.AddLineBreaks;
 }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the EdiOptions class with values copied from the specified EdiOptions parameter.
 /// </summary>
 /// <param name="source">An EdiOptions containing values to copy.</param>
 public EdiOptions(EdiOptions source)
 {
     SegmentTerminator   = source.SegmentTerminator;
     ElementSeparator    = source.ElementSeparator;
     ComponentSeparator  = source.ComponentSeparator;
     RepetitionSeparator = source.RepetitionSeparator;
     DecimalIndicator    = source.DecimalIndicator;
     ReleaseCharacter    = source.ReleaseCharacter;
     AddLineBreaks       = source.AddLineBreaks;
 }
Пример #7
0
 public void StringifyingAComponentContainerSeparatorsWithAReleaseCharacter()
 {
     var component = new EdiComponent(":+.? '");
     var options = new EdiOptions
     {
         ComponentSeparator = ':',
         ElementSeparator = '+',
         ReleaseCharacter = '?',
         SegmentTerminator = '\''
     };
     Assert.AreEqual("?:?+.?? ?'", component.ToString(options));
 }
Пример #8
0
        public void ConvertingAnElementToAStringWithSpecificSeparators()
        {
            var element = new EdiElement();

            element.Repetitions.Add(new EdiRepetition("1234"));
            element.Repetitions.Add(new EdiRepetition("5678"));
            var options = new EdiOptions {
                RepetitionSeparator = '^'
            };

            Assert.AreEqual("1234^5678", element.ToString(options));
        }
Пример #9
0
        public void ConvertingARepetitionToAStringWithSpecificSeparators()
        {
            var repetition = new EdiRepetition();

            repetition[02] = "1234";
            repetition[04] = "5678";
            var options = new EdiOptions {
                ComponentSeparator = '<'
            };

            Assert.AreEqual("<1234<<5678", repetition.ToString(options));
        }
Пример #10
0
        public void ConvertingASegmentToAStringWithSpecificSeparators()
        {
            var segment = new EdiSegment("SEG");

            segment[02] = "1234";
            segment[04] = "5678";
            var options = new EdiOptions {
                SegmentTerminator = '~'
            };

            Assert.AreEqual("SEG**1234**5678~", segment.ToString(options));
        }
Пример #11
0
        public void ConvertingAUnaSegmentToAString()
        {
            var segment = new EdiSegment("UNA");
            var options = new EdiOptions
            {
                ComponentSeparator = ':',
                ElementSeparator   = '+',
                ReleaseCharacter   = '?',
                SegmentTerminator  = '\''
            };

            Assert.AreEqual("UNA:+.? '", segment.ToString(options));
        }
Пример #12
0
        public void ConvertingAUnaSegmentToAString()
        {
            var segment = new EdiSegment("UNA");
            var options = new EdiOptions
            {
                ComponentSeparator = ':',
                ElementSeparator = '+',
                ReleaseCharacter = '?',
                SegmentTerminator = '\''
            };

            Assert.AreEqual("UNA:+.? '", segment.ToString(options));
        }
Пример #13
0
        public void StringifyingAComponentContainerSeparatorsWithAReleaseCharacter()
        {
            var component = new EdiComponent(":+.? '");
            var options   = new EdiOptions
            {
                ComponentSeparator = ':',
                ElementSeparator   = '+',
                ReleaseCharacter   = '?',
                SegmentTerminator  = '\''
            };

            Assert.AreEqual("?:?+.?? ?'", component.ToString(options));
        }
Пример #14
0
        public void SavingAValueContainingASeparator()
        {
            var options = new EdiOptions {
                SegmentTerminator = '~', ElementSeparator = '*'
            };
            var document = new EdiDocument(options);
            var segment  = new EdiSegment("SEG");

            segment[01] = document.Options.ElementSeparator.ToString();
            document.Segments.Add(segment);
            var buffer = new StringWriter();

            document.Save(buffer);
        }
Пример #15
0
        public void ReadingASegment()
        {
            var options = new EdiOptions
            {
                ElementSeparator  = '*',
                SegmentTerminator = '~'
            };
            EdiDocument document = EdiDocument.Parse("ST*997*0001~", options);

            Assert.AreEqual(1, document.Segments.Count);
            Assert.AreEqual("ST", document.Segments[0].Id);
            Assert.AreEqual(2, document.Segments[0].Elements.Count);
            Assert.AreEqual("997", document.Segments[0].Elements[0].Value);
            Assert.AreEqual("0001", document.Segments[0].Elements[1].Value);
        }
Пример #16
0
        public void ReadingASegment()
        {
            var options = new EdiOptions
                              {
                                  ElementSeparator = '*',
                                  SegmentTerminator = '~'
                              };
            EdiDocument document = EdiDocument.Parse("ST*997*0001~", options);

            Assert.AreEqual(1, document.Segments.Count);
            Assert.AreEqual("ST", document.Segments[0].Id);
            Assert.AreEqual(2, document.Segments[0].Elements.Count);
            Assert.AreEqual("997", document.Segments[0].Elements[0].Value);
            Assert.AreEqual("0001", document.Segments[0].Elements[1].Value);
        }
Пример #17
0
 public void SavingAValueContainingASeparator()
 {
     var options = new EdiOptions {SegmentTerminator = '~', ElementSeparator = '*'};
     var document = new EdiDocument(options);
     var segment = new EdiSegment("SEG");
     segment[01] = document.Options.ElementSeparator.ToString();
     document.Segments.Add(segment);
     var buffer = new StringWriter();
     document.Save(buffer);
 }
Пример #18
0
 public void StringifyingAComponentContainingASpecificSeparator()
 {
     var component = new EdiComponent("a>b");
     var options = new EdiOptions {ComponentSeparator = '>'};
     Assert.AreEqual("a>b", component.ToString(options));
 }