/// <summary> /// Delivery an MDM entity as a data contract for a mapping request /// </summary> /// <param name="request"></param> /// <returns></returns> public ContractResponse <TContract> Map(MappingRequest request) { if (request == null) { throw new ArgumentNullException("request"); } if (request.IsNexusMappingRequest()) { if (request.HasNumericIdentifier()) { return(this.Request(request.ToGetRequest())); } else { var response = this.ContractResponse(null, request.ValidAt, request.Version); response.Error.Reason = ErrorReason.Identifier; return(response); } } this.Validate(request); var mapping = this.repository.FindAllMappings <TMapping>(request).FirstOrDefault(m => m.Entity is TEntity); if (mapping == null) { var response = ContractResponse(null, request.ValidAt, request.Version); response.Error.Reason = ErrorReason.Identifier; return(response); } return(ContractResponse(mapping.Entity as TEntity, request.ValidAt, request.Version)); }
public void IsNexusMappingRequest_NexusSourceSystem_ReturnsTrue() { var mappingRequest = new MappingRequest { SystemName = SourceSystemNames.Nexus, Identifier = "999" }; Assert.IsTrue(mappingRequest.IsNexusMappingRequest()); }
public void IsNexusMappingRequest_NexusSourceSystem_ReturnsTrue() { var mappingRequest = new MappingRequest { SystemName = SourceSystemNames.Nexus, Identifier = "999" }; Assert.IsTrue(mappingRequest.IsNexusMappingRequest()); }
public void IsNexusMappingRequest_EmptySourceSystem_ReturnsFalse() { var mappingRequest = new MappingRequest(); Assert.IsFalse(mappingRequest.IsNexusMappingRequest()); }
public void IsNexusMappingRequest_EmptySourceSystem_ReturnsFalse() { var mappingRequest = new MappingRequest(); Assert.IsFalse(mappingRequest.IsNexusMappingRequest()); }