public List <SyncClientPriorityDTO> LoadClientIdsWithRelations(Guid pracId) { var list = new List <SyncClientPriorityDTO>(); // index only var relations = _clientRelationshipRepository.GetPracticeRelationships(pracId).ToList(); if (relations.Any()) { list = SyncClientPriorityDTO.Create(relations); } return(list); }
public void should_Create() { var dto = SyncClientPriorityDTO.Create(_relations); Assert.True(dto.Any()); foreach (var d in dto) { Console.WriteLine(d.IndexId); foreach (var secondaryId in d.SecondaryIds) { Console.WriteLine($" {secondaryId}"); } } Assert.AreEqual(5, dto.Count + dto.SelectMany(x => x.SecondaryIds).Count()); var dtoo = SyncClientPriorityDTO.Create(new List <ClientRelationship>()); Assert.False(dtoo.Any()); Assert.AreEqual(0, dtoo.Count + dtoo.SelectMany(x => x.SecondaryIds).Count()); }