public void Should_Throw_Exception_When_Link_Does_Not_Exists() { var linkedParticipant = new LinkedParticipant(_linkedIndividual.Id, Guid.NewGuid(), LinkedParticipantType.Interpreter); _individual.Invoking(x => x.RemoveLink(linkedParticipant)).Should() .Throw <DomainRuleException>(); }
public Task CreateParticipantLinks(List <Participant> participants, List <LinkedParticipantDto> linkedParticipantDtos) { var linkedParticipants = new List <LinkedParticipant>(); foreach (var linkedParticipantDto in linkedParticipantDtos) { var interpretee = participants.Single(x => x.Person.ContactEmail.Equals(linkedParticipantDto.ParticipantContactEmail, StringComparison.CurrentCultureIgnoreCase)); var interpreter = participants.Single(x => x.Person.ContactEmail.Equals(linkedParticipantDto.LinkedParticipantContactEmail, StringComparison.CurrentCultureIgnoreCase)); var linkedParticipant = new LinkedParticipant(interpretee.Id, interpreter.Id, linkedParticipantDto.Type); linkedParticipants.Add(linkedParticipant); UpdateParticipantsWithLinks(interpretee, interpreter, linkedParticipantDto.Type); } return(Task.FromResult(linkedParticipants)); }
public static LinkedParticipantResponse MapLinkedParticipantsToResponse(LinkedParticipant linkedParticipant) { return(new LinkedParticipantResponse() { Type = linkedParticipant.Type.MapToContractEnum(), LinkedId = linkedParticipant.LinkedId }); }
public static LinkedParticipantDto MapToDto(LinkedParticipant linkedParticipant) { return(new LinkedParticipantDto { ParticipantId = linkedParticipant.ParticipantId, LinkedId = linkedParticipant.LinkedId, Type = linkedParticipant.Type }); }
public void should_map_all_properties() { var linkedParticipant = new LinkedParticipant(Guid.NewGuid(), Guid.NewGuid(), LinkedParticipantType.Interpreter); var response = LinkedParticipantToResponseMapper.MapLinkedParticipantsToResponse(linkedParticipant); response.LinkedId.Should().Be(linkedParticipant.LinkedId); response.Type.Should().Be(linkedParticipant.Type); }
public void RemoveLink(LinkedParticipant linkedParticipant) { var link = LinkedParticipants.SingleOrDefault( x => x.LinkedId == linkedParticipant.LinkedId && x.Type == linkedParticipant.Type); if (link == null) { throw new DomainRuleException("LinkedParticipant", "Link does not exist"); } LinkedParticipants.Remove(linkedParticipant); }
private bool HasExistingLink(LinkedParticipant linkedParticipantInRequest, ParticipantResponse participant) { var linkedId = linkedParticipantInRequest.LinkedId; var existingLink = false; if (participant.LinkedParticipants != null) { existingLink = participant.LinkedParticipants.Exists(x => x.LinkedId == linkedId); } return(existingLink); }
public void SetUp() { _linkedParticipant = BuildLinkedParticipant(); }