public void ToDelimitedString_WithAllProperties_ReturnsCorrectlySequencedFields()
        {
            ISegment hl7Segment = new AffSegment
            {
                SetIdAff = 1,
                ProfessionalOrganization = new ExtendedCompositeNameAndIdNumberForOrganizations
                {
                    OrganizationName = "2"
                },
                ProfessionalOrganizationAddress = new ExtendedAddress
                {
                    StreetAddress = new StreetAddress
                    {
                        StreetOrMailingAddress = "3"
                    }
                },
                ProfessionalOrganizationAffiliationDateRange = new DateTimeRange[]
                {
                    new DateTimeRange
                    {
                        RangeStartDateTime = new DateTime(2020, 4, 4, 0, 0, 4)
                    }
                },
                ProfessionalAffiliationAdditionalInformation = "5"
            };

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

            Assert.Equal(expected, actual);
        }
        public void FromDelimitedString_WithAllProperties_ReturnsCorrectlyInitializedFields()
        {
            ISegment expected = new AffSegment
            {
                SetIdAff = 1,
                ProfessionalOrganization = new ExtendedCompositeNameAndIdNumberForOrganizations
                {
                    OrganizationName = "2"
                },
                ProfessionalOrganizationAddress = new ExtendedAddress
                {
                    StreetAddress = new StreetAddress
                    {
                        StreetOrMailingAddress = "3"
                    }
                },
                ProfessionalOrganizationAffiliationDateRange = new DateTimeRange[]
                {
                    new DateTimeRange
                    {
                        RangeStartDateTime = new DateTime(2020, 4, 4, 0, 0, 4)
                    }
                },
                ProfessionalAffiliationAdditionalInformation = "5"
            };

            ISegment actual = new AffSegment();

            actual.FromDelimitedString("AFF|1|2|3|20200404000004|5");

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