Exemplo n.º 1
0
        public void ToDelimitedString_WithAllProperties_ReturnsCorrectlySequencedFields()
        {
            ISegment hl7Segment = new EvnSegment
            {
                EventTypeCode        = "1",
                RecordedDateTime     = new DateTime(2020, 2, 2, 0, 0, 2),
                DateTimePlannedEvent = new DateTime(2020, 3, 3, 0, 0, 3),
                EventReasonCode      = new CodedWithExceptions
                {
                    Identifier = "4"
                },
                OperatorId = new ExtendedCompositeIdNumberAndNameForPersons[]
                {
                    new ExtendedCompositeIdNumberAndNameForPersons
                    {
                        PersonIdentifier = "5"
                    }
                },
                EventOccurred = new DateTime(2020, 6, 6, 0, 0, 6),
                EventFacility = new HierarchicDesignator
                {
                    NamespaceId = "7"
                }
            };

            string expected = "EVN|1|20200202000002|20200303000003|4|5|20200606000006|7";
            string actual   = hl7Segment.ToDelimitedString();

            Assert.Equal(expected, actual);
        }
Exemplo n.º 2
0
        public void FromDelimitedString_WithAllProperties_ReturnsCorrectlyInitializedFields()
        {
            ISegment expected = new EvnSegment
            {
                EventTypeCode        = "1",
                RecordedDateTime     = new DateTime(2020, 2, 2, 0, 0, 2),
                DateTimePlannedEvent = new DateTime(2020, 3, 3, 0, 0, 3),
                EventReasonCode      = new CodedWithExceptions
                {
                    Identifier = "4"
                },
                OperatorId = new ExtendedCompositeIdNumberAndNameForPersons[]
                {
                    new ExtendedCompositeIdNumberAndNameForPersons
                    {
                        PersonIdentifier = "5"
                    }
                },
                EventOccurred = new DateTime(2020, 6, 6, 0, 0, 6),
                EventFacility = new HierarchicDesignator
                {
                    NamespaceId = "7"
                }
            };

            ISegment actual = new EvnSegment();

            actual.FromDelimitedString("EVN|1|20200202000002|20200303000003|4|5|20200606000006|7");

            expected.Should().BeEquivalentTo(actual);
        }
Exemplo n.º 3
0
 public void FromDelimitedString_WithIncorrectSegmentId_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         ISegment hl7Segment = new EvnSegment();
         hl7Segment.FromDelimitedString("EVA|^~&|3|4|5|6");
     });
 }