private void GivenTheJob(Job job, MergeSpecificationInformationRequest mergeRequest, Reference user, string correlationId, string providerId = null) { _jobs.Setup(_ => _.QueueJob(It.Is <JobCreateModel>(jb => (providerId == null || HasProviderIdInProperties(jb, providerId)) && jb.CorrelationId == correlationId && jb.InvokerUserId == user.Id && jb.InvokerUserDisplayName == user.Name && jb.MessageBody == mergeRequest.AsJson(true) && jb.JobDefinitionId == JobConstants.DefinitionNames.MergeSpecificationInformationForProviderJob))) .ReturnsAsync(job); }
public async Task <IActionResult> QueueMergeSpecificationInformationJob(MergeSpecificationInformationRequest mergeRequest, Reference user, string correlationId) { Guard.ArgumentNotNull(mergeRequest, nameof(mergeRequest)); JobCreateModel job = new JobCreateModel { JobDefinitionId = JobConstants.DefinitionNames.MergeSpecificationInformationForProviderJob, InvokerUserId = user?.Id, InvokerUserDisplayName = user?.Name, CorrelationId = correlationId, Trigger = new Trigger { Message = "Specification or Results change require merging specification information for providers with results", EntityType = "Specification", EntityId = mergeRequest.SpecificationInformation.Id }, MessageBody = mergeRequest.AsJson() }; return(new OkObjectResult(await _jobsPolicy.ExecuteAsync(() => _jobs.QueueJob(job)))); }