protected override void InternalHasValidationResult(EntityValidationFacade validationFacade, KeyValuePair <string, List <dynamic> > properties) { // If there are already critical errors that apply to the property, no further validation is performed. if (properties.Value == null || validationFacade.ValidationResults.Any(v => v.Node == validationFacade.RequestResource.Id && v.Path == properties.Key && v.ResultSeverity == ValidationResultSeverity.Violation)) { return; } foreach (var propertyValue in properties.Value) { if (propertyValue is Entity propertyEntity) { if (!_attachmentService.Exists(propertyEntity.Id.ToString())) { var validationResultProperty = new ValidationResultProperty(validationFacade.RequestResource.Id, properties.Key, propertyEntity.Id, string.Format(Common.Constants.Messages.Attachment.NotExists, propertyEntity.Id), ValidationResultSeverity.Violation); validationFacade.ValidationResults.Add(validationResultProperty); } } } ; }
public void Exists_Should_Call_CheckIfEntityExists(string id) { _output.WriteLine($"Testing id: `{id}`"); _service.Exists(id); _mockAttachmentRepository.Verify(x => x.CheckIfEntityExists(id, It.IsAny <IList <string> >(), It.IsAny <HashSet <Uri> >()), Times.Once); }