예제 #1
0
 public void FromDelimitedString_WithIncorrectSegmentId_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         ISegment hl7Segment = new QakSegment();
         hl7Segment.FromDelimitedString("QAA|^~&|3|4|5|6");
     });
 }
예제 #2
0
        public void ToDelimitedString_WithAllProperties_ReturnsCorrectlySequencedFields()
        {
            ISegment hl7Segment = new QakSegment
            {
                QueryTag            = "1",
                QueryResponseStatus = "2",
                MessageQueryName    = new CodedWithExceptions
                {
                    Identifier = "3"
                },
                HitCountTotal = 4,
                ThisPayload   = 5,
                HitsRemaining = 6
            };

            string expected = "QAK|1|2|3|4|5|6";
            string actual   = hl7Segment.ToDelimitedString();

            Assert.Equal(expected, actual);
        }
 internal void parse(string rawMessage)
 {
     string[] segments = StringUtils.split(rawMessage, '\r');
     if (segments.Length < 4)
     {
         throw new Exception("Invalid message: needs 5 segments");
     }
     MSH = new MshSegment(segments[0]);
     MSA = new MsaSegment(segments[1]);
     QAK = new QakSegment(segments[2]);
     RDF = new RdfSegment(segments[3]);
     if (segments.Length > 4)
     {
         RDT = new RdtSegment[segments.Length - 4];
         for (int rdtIdx = 0, segIdx = 4; segIdx < segments.Length; rdtIdx++, segIdx++)
         {
             RDT[rdtIdx] = new RdtSegment(RDF, segments[segIdx]);
         }
     }
 }
예제 #4
0
        public void FromDelimitedString_WithAllProperties_ReturnsCorrectlyInitializedFields()
        {
            ISegment expected = new QakSegment
            {
                QueryTag            = "1",
                QueryResponseStatus = "2",
                MessageQueryName    = new CodedWithExceptions
                {
                    Identifier = "3"
                },
                HitCountTotal = 4,
                ThisPayload   = 5,
                HitsRemaining = 6
            };

            ISegment actual = new QakSegment();

            actual.FromDelimitedString("QAK|1|2|3|4|5|6");

            expected.Should().BeEquivalentTo(actual);
        }