public void Test() { var nhsNumber = Identifiers.NhsNumber.Value("32222"); output.WriteLine( JsonConvert.SerializeObject( new PersonSpecification( new CHC.Consent.Api.Client.Models.IIdentifierValueDto[] { Identifiers.DateOfBirth.Value(1.December(2018)), Identifiers.HospitalNumber.Value("1112333"), nhsNumber, ClientIdentifierValues.Address("3 Sheaf Street", "Leeds", postcode: "LS10 1HD") }, UpdateMode.CreateOrUpdate, "medway", new[] { new CHC.Consent.Api.Client.Models.IdentifierMatchSpecification( new CHC.Consent.Api.Client.Models.IIdentifierValueDto[] { nhsNumber }) } ), Formatting.Indented ) ); }
private static StudySubjectWithIdentifiers Person( string subjectIdentifier, string firstName = null, string lastname = null, DateTime?dateOfBirth = null, params IIdentifierValueDto[] otherIdentifiers ) { var identifiers = new List <IIdentifierValueDto>(otherIdentifiers); if (firstName != null || lastname != null) { identifiers.Add(ClientIdentifierValues.Name(firstName, lastname)); } if (dateOfBirth != null) { identifiers.Add(KnownIdentifiers.DateOfBirth.Value(dateOfBirth.Value)); } return(new StudySubjectWithIdentifiers { subjectIdentifier = subjectIdentifier, identifiers = identifiers }); }
public void CanParsePartialAddress() { var parser = CreateParser(Identifiers.Definitions.Address); var identifierValue = parser.Parse( IdentifierElement( "address", IdentifierElement("line-1", "1 Testing Street"), IdentifierElement("postcode", "TS1 3ST")) ); identifierValue.Should().BeEquivalentTo(ClientIdentifierValues.Address("1 Testing Street", postcode: "TS1 3ST")); }
public void CanParseNameIdentifier() { var parser = CreateParser(Identifiers.Definitions.Name); var identifierValue = parser.Parse( IdentifierElement("name", IdentifierElement("given", "Fred"), IdentifierElement("family", "Whitton") ) ); identifierValue.Should().BeEquivalentTo(ClientIdentifierValues.Name("Fred", "Whitton")); }
private static void AssertAddress( IIdentifierValueDto address, string line1 = null, string line2 = null, string line3 = null, string line4 = null, string line5 = null, string postcode = null) { address.Should().BeEquivalentTo( ClientIdentifierValues.Address( line1, line2, line3, line4, line5, postcode) ); }
public void WhenExportingFields_FieldsAreWrittenInCorrectOrder() { Export( new[] { KnownIdentifiers.Address, KnownIdentifiers.DateOfBirth, KnownIdentifiers.Name, }, fieldNames: new[] { "name::given", "name::family", "address::postcode" }, Person( "001", "First name", "Surname", 27.April(2014), ClientIdentifierValues.Address(postcode: "SN13 7HG") ) ) .Should() .BeEquivalentTo( "id,name::given,name::family,address::postcode", "001,First name,Surname,SN13 7HG", "" ); }