public GeneratedDocumentDomain Generate(string inputContent, string fileName, DocumentTypeEnum inputDocType, DocumentTypeEnum outputDocTypeDomain, Nullable <int> templateVersionId) { DocumentTypeDomain inputType = _documentTypeRepository.GetByName(inputDocType.ToString("g")); DocumentTypeDomain outputType = _documentTypeRepository.GetByName(outputDocTypeDomain.ToString("g")); return(Generate(inputContent, fileName, inputType, outputType, templateVersionId)); }
// Helper method for readability // Returns true if input == expectedInput AND output == expectedOutput private bool CompareDocTypes(DocumentTypeDomain inputDocType, DocumentTypeDomain outputDocTypeDomain, DocumentTypeEnum expectedInput, DocumentTypeEnum expectedOutput) { // "g" means that the conversion of enum to string will be the most intuitive one // For example, if the enum value is MyValue then ToString("g") will return "MyValue" return(string.Equals(inputDocType.Name, expectedInput.ToString("g"), StringComparison.CurrentCultureIgnoreCase) && string.Equals(outputDocTypeDomain.Name, expectedOutput.ToString("g"), StringComparison.CurrentCultureIgnoreCase)); }
private void showError(DocumentTypeEnum type) { throw new ArgumentException(type.ToString() + " Inválido"); }