public async Task UpdateAsync( string solutionId, IEnumerable <IContact> newContacts, CancellationToken cancellationToken) { await repository.ReplaceContactsForSolution(solutionId, newContacts, cancellationToken); }
public async Task InsertingContactsReplacesCurrent() { await InsertContact(_solutionId1); await InsertContact(_solutionId1); var expectedContacts = new List <IContact> { Mock.Of <IContact>(c => c.FirstName == "BillyBob") }; await _marketingContactRepository.ReplaceContactsForSolution(_solutionId1, expectedContacts, new CancellationToken()); var newContacts = (await _marketingContactRepository.BySolutionIdAsync(_solutionId1, new CancellationToken())).ToList(); newContacts.Should().BeEquivalentTo(expectedContacts, config => config.Excluding(e => e.Name)); newContacts.ForEach(async x => (await x.LastUpdated.SecondsFromNow()).Should().BeLessOrEqualTo(5)); }
public async Task UpdateAsync(string solutionId, IEnumerable <IContact> newContacts, CancellationToken cancellationToken) => await _repository.ReplaceContactsForSolution(solutionId, newContacts, cancellationToken).ConfigureAwait(false);