/// <summary> /// Constructor for the SEVIS Comm object, must be passed the application settings object to have the upload/download URLS and Cert thumbprint /// </summary> /// <param name="appSettings">The application settings object</param> public SevisComm(AppSettings appSettings, IEcaHttpMessageHandlerService theHttpMessageHandlerService) { DownloadUri = new Uri(appSettings.SevisDownloadUri); UploadUri = new Uri(appSettings.SevisUploadUri); Thumbprint = appSettings.SevisThumbprint; httpMessageHandlerService = theHttpMessageHandlerService; }
public void TestInit() { mockedEcaHttpMesssageHandlerService = new mockEcaWebRequestHandlerService(); settings = new NameValueCollection(); settings.Add("sevis.UploadUri", uploadUrl); settings.Add("sevis.DownloadUri", downloadUrl); settings.Add("sevis.Thumbprint", "f6d68b2d9b7018ed94f78f18cb6c020e3aed28c7"); appSettings = new AppSettings(settings, null); }
/// <summary> /// Creates a new Functions instance. /// </summary> /// <param name="service">The sevis batch processing service.</param> /// <param name="appSettings">The app settings.</param> public Functions(ISevisBatchProcessingService service, ISevisApiResponseHandler responseHandler, IEcaHttpMessageHandlerService theEcaHttpMessageHandlerService, AppSettings appSettings) { Contract.Requires(service != null, "The service must not be null."); Contract.Requires(responseHandler != null, "The response handler must not be null."); Contract.Requires(appSettings != null, "The app settings must not be null."); Contract.Requires(theEcaHttpMessageHandlerService != null, "The app settings must not be null."); this.responseHandler = responseHandler; this.service = service; this.ecaHttpMessageHandlerService = theEcaHttpMessageHandlerService; this.appSettings = appSettings; }
/// <summary> /// /// </summary> /// <param name="disposing"></param> protected virtual void Dispose(bool disposing) { if (disposing) { if (this.service is IDisposable) { logger.Trace("Disposing of service " + this.service.GetType()); ((IDisposable)this.service).Dispose(); this.service = null; } if (this.responseHandler is IDisposable) { logger.Trace("Disposing of response handler " + this.responseHandler.GetType()); ((IDisposable)this.responseHandler).Dispose(); this.responseHandler = null; } if (this.ecaHttpMessageHandlerService is IDisposable) { logger.Trace("Disposing of response handler " + this.ecaHttpMessageHandlerService.GetType()); ((IDisposable)this.ecaHttpMessageHandlerService).Dispose(); this.ecaHttpMessageHandlerService = null; } } }