public async Task MainAsync(string[] args) { LogManager.LoadConfiguration("nlog.config"); ILoggerFactory loggerFactory = new NLogLoggerFactory(); var logger = loggerFactory.CreateLogger <Program>(); try { var configuration = CreateConfigurationObject(); var clinicalDocumentAPIConfig = new ClinicalDocumentAPIConfig(); configuration.Bind(clinicalDocumentAPIConfig); var options = Options.Create(clinicalDocumentAPIConfig); _restClinicalDocumentAPI = new RestClinicalDocumentAPI(options, loggerFactory); _documentDetailRequest = CreateDocumentDetailRequest(); //POST endpoint of clinical document - Save Clinical Documents var saveClinicalDocumentsResult = await _restClinicalDocumentAPI.SaveClinicalDocumentDetails(_documentDetailRequest); //GET endpoint of clinical document - Get Clinical Documents var getClinicalDocumentsResult = await _restClinicalDocumentAPI.GetClinicalDocumentDetails("TEST", "12345"); } catch (Exception ex) { logger.LogError(ex, "Exception at Clinical Document Console application"); Console.WriteLine(ex); } }
public async void ThrowsExceptionFromGetClinicalDocumentsWhenURLIsInvalid() { var mockILogger = new Mock <ILoggerFactory>(); var mockIOptionsClinicalDocumentAPIConfig = new Mock <IOptions <ClinicalDocumentAPIConfig> >(); var mockIRestClinicalDocumentAPI = new Mock <IRestClinicalDocumentAPI>(); SetClinicalDocumentApiConfig(inValidUrl, mockIOptionsClinicalDocumentAPIConfig); var restClinicalDocumentAPI = new RestClinicalDocumentAPI(mockIOptionsClinicalDocumentAPIConfig.Object, mockILogger.Object); await Assert.ThrowsAsync <NullReferenceException>(() => restClinicalDocumentAPI.GetClinicalDocumentDetails("TEST", "123456")); }
public async void GetClinicalDocumentsReturnsBadRequestWhenParameterPassedIsNull() { var mockILogger = new Mock <ILoggerFactory>(); var mockIOptionsClinicalDocumentAPIConfig = new Mock <IOptions <ClinicalDocumentAPIConfig> >(); SetClinicalDocumentApiConfig(validUrl, mockIOptionsClinicalDocumentAPIConfig); var restClinicalDocumentAPI = new RestClinicalDocumentAPI(mockIOptionsClinicalDocumentAPIConfig.Object, mockILogger.Object); var result = await restClinicalDocumentAPI.GetClinicalDocumentDetails(null, "123456"); Assert.True(!(result.IsValid)); Assert.Null(result.ClinicalDocumentMetadata); }
public async void GetClinicalDocuments() { var mockILogger = new Mock <ILoggerFactory>(); var mockIOptionsClinicalDocumentAPIConfig = new Mock <IOptions <ClinicalDocumentAPIConfig> >(); var mockIRestClinicalDocumentAPI = new Mock <IRestClinicalDocumentAPI>(); SetClinicalDocumentApiConfig(validUrl, mockIOptionsClinicalDocumentAPIConfig); var restClinicalDocumentAPI = new RestClinicalDocumentAPI(mockIOptionsClinicalDocumentAPIConfig.Object, mockILogger.Object); var result = await restClinicalDocumentAPI.GetClinicalDocumentDetails("SURG", "89455455"); Assert.Contains("Records found", result.Status); Assert.True(result.ClinicalDocumentMetadata.Count > 0); }