/// <inheritdoc />
            public TIdentifier MarshallToIdentifier(IIdentifierValueDto dto)
            {
                var value       = (IIdentifierValueDto[])dto.Value;
                var identifiers = identifierDtoMarshaller.ConvertToIdentifiers(value);

                return(CreateIdentifier(Definition, new CompositeIdentifierValue <TIdentifier>(identifiers)));
            }
Exemplo n.º 2
0
        public void CanSendIdentitiesToServer(IIdentifierValueDto identifier, Action <IIdentifierValueDto> checkResult)
        {
            PersonCreatedResult response = null;

            ApiClient.Invoking(
                _ => response = _.PutPerson(
                    new PersonSpecification(
                        new List <IIdentifierValueDto> {
                identifier
            },
                        UpdateMode.CreateOrUpdate,
                        "medway",
                        new List <MatchSpecification>
            {
                new IdentifierMatchSpecification {
                    Identifiers = new List <IIdentifierValueDto> {
                        identifier
                    }
                }
            }))
                )
            .Should().NotThrow();

            Assert.NotNull(response);

            var identities = ApiClient.GetPerson(response.PersonId);

            Output.WriteLine(string.Join("\n", identities.Select(_ => _.ToString())));

            checkResult(Assert.Single(identities));
        }
        private void WriteCompositeValue(IIdentifierValueDto dto, IWriterRow writer)
        {
            var compositeDto = (IdentifierValueDtoIIdentifierValueDto)dto;
            var subValues    = compositeDto?.Value ?? Enumerable.Empty <IIdentifierValueDto>();

            Write(subValues, writer);
        }
 private TIdentifier MarshallToIdentifier(IIdentifierValueDto dto)
 {
     if (!Marshallers.ContainsKey(dto.SystemName))
     {
         throw new InvalidOperationException($"{dto.SystemName} is not a known type");
     }
     return(Marshallers[dto.SystemName].MarshallToIdentifier(dto));
 }
Exemplo n.º 5
0
 protected void RecordConsent(
     IIdentifierValueDto evidence,
     DateTime dateGiven,
     long?givenByPersonId = null,
     IConsentRepository consentRepository = null,
     long?studyId             = null,
     string subjectIdentifier = null,
     long?personId            = null
     ) =>
 RecordConsent(
     new[] { evidence },
     dateGiven,
     givenByPersonId,
     consentRepository,
     studyId,
     subjectIdentifier,
     personId);
Exemplo n.º 6
0
 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)
         );
 }
Exemplo n.º 7
0
 private static Expression <Func <IIdentifierValueDto, bool> > Identifier(IIdentifierValueDto value)
 {
     return(actual => HasSameName(actual, value) && HasSameValue(actual, value));
 }
 /// <inheritdoc />
 public TIdentifier MarshallToIdentifier(IIdentifierValueDto dto)
 {
     return(CreateIdentifier(Definition, new SimpleIdentifierValue(dto.Value)));
 }
Exemplo n.º 9
0
 public static bool IsValidIdentifierType(
     this IdentifierDefinitionRegistry identifierDefinitionRegistry,
     IIdentifierValueDto identifier)
 {
     return(identifierDefinitionRegistry.ContainsKey(identifier.SystemName));
 }