Esempio n. 1
0
        public void CanParseWholePerson()
        {
            const string personXml = @"<?xml version=""1.0""?>
<people authority=""test"">
    <person>
        <identity>
            <identifier type=""nhs-number"">4099999999</identifier>
            <identifier type=""bradford-hospital-number"">RAE9999999</identifier>
            <identifier type=""name""><identifier type=""given"">Jo</identifier><identifier type=""family"">Bloggs</identifier></identifier>
            <identifier type=""date-of-birth"">1990-06-16</identifier>
            <identifier type=""address"">
                <identifier type=""line-1"">22 Love Street</identifier>
                <identifier type=""line-2"">Holmestown</identifier>
                <identifier type=""line-3"">Bradtopia</identifier>
                <identifier type=""line-4"">West Yorkshire</identifier>
                <identifier type=""postcode"">BD92 4FX</identifier>
            </identifier>
        </identity>
        <lookup>
            <match><identifier type=""nhs-number"">4099999999</identifier></match>
            <match><identifier type=""bradford-hospital-number"">RAE9999999</identifier></match>
        </lookup>
        <consent date-given=""2017-10-14"" study-id=""1"">
			<given-by>
				<match><identifier type=""nhs-number"">4099999999</identifier></match>
				<match><identifier type=""bradford-hospital-number"">RAE9999999</identifier></match>
			</given-by>
            <evidence>
                <evidence type=""medway"">
                    <evidence type=""consent-taken-by"">Betsey Trotwood</evidence>
                </evidence>
            </evidence>
        </consent>
    </person>
</people>";


            var xmlReader     = CreateXmlReader(personXml);
            var specification = new XmlParser(
                Identifiers.Registry.ConvertToClientDefinitions(),
                KnownEvidence.Registry.ConvertToClientDefinitions())
                                .GetPeople(xmlReader)
                                .Single();
            var person = specification.PersonSpecification;


            Assert.DoesNotContain(person.Identifiers, identifier => identifier == null);
            Assert.Collection(
                person.Identifiers,
                Matches.NhsNumber("4099999999"),
                Matches.HospitalNumber("RAE9999999"),
                Matches.Name("Jo", "Bloggs"),
                Matches.DateOfBirth(16.June(1990)),
                Matches.Address("22 Love Street", "Holmestown", "Bradtopia", "West Yorkshire", postcode: "BD92 4FX")
                );

            person.MatchSpecifications
            .Should()
            .BeEquivalentTo(
                new IdentifierMatchSpecification(Identifiers.Definitions.NhsNumber.Value("4099999999")),
                new IdentifierMatchSpecification(Identifiers.Definitions.HospitalNumber.Value("RAE9999999"))
                );
        }