예제 #1
0
        public void ToDelimitedString_WithAllProperties_ReturnsCorrectlySequencedFields()
        {
            ISegment hl7Segment = new PthSegment
            {
                ActionCode = "1",
                PathwayId  = new CodedWithExceptions
                {
                    Identifier = "2"
                },
                PathwayInstanceId = new EntityIdentifier
                {
                    EntityId = "3"
                },
                PathwayEstablishedDateTime = new DateTime(2020, 4, 4, 0, 0, 4),
                PathwayLifeCycleStatus     = new CodedWithExceptions
                {
                    Identifier = "5"
                },
                ChangePathwayLifeCycleStatusDateTime = new DateTime(2020, 6, 6, 0, 0, 6),
                MoodCode = new CodedWithNoExceptions
                {
                    Identifier = "7"
                }
            };

            string expected = "PTH|1|2|3|20200404000004|5|20200606000006|7";
            string actual   = hl7Segment.ToDelimitedString();

            Assert.Equal(expected, actual);
        }
예제 #2
0
        public void FromDelimitedString_WithAllProperties_ReturnsCorrectlyInitializedFields()
        {
            ISegment expected = new PthSegment
            {
                ActionCode = "1",
                PathwayId  = new CodedWithExceptions
                {
                    Identifier = "2"
                },
                PathwayInstanceId = new EntityIdentifier
                {
                    EntityId = "3"
                },
                PathwayEstablishedDateTime = new DateTime(2020, 4, 4, 0, 0, 4),
                PathwayLifeCycleStatus     = new CodedWithExceptions
                {
                    Identifier = "5"
                },
                ChangePathwayLifeCycleStatusDateTime = new DateTime(2020, 6, 6, 0, 0, 6),
                MoodCode = new CodedWithNoExceptions
                {
                    Identifier = "7"
                }
            };

            ISegment actual = new PthSegment();

            actual.FromDelimitedString("PTH|1|2|3|20200404000004|5|20200606000006|7");

            expected.Should().BeEquivalentTo(actual);
        }
예제 #3
0
 public void FromDelimitedString_WithIncorrectSegmentId_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         ISegment hl7Segment = new PthSegment();
         hl7Segment.FromDelimitedString("PTA|^~&|3|4|5|6");
     });
 }