ValidationResult CanConnectServer(WebSource source) { try { ErrorResultTO errors; return(new ValidationResult { Result = Execute(source, WebRequestMethod.Get, source.DefaultQuery, (string)null, true, out errors) }); } catch (WebException wex) { RaiseError(wex); var errors = new StringBuilder(); Exception ex = wex; while (ex != null) { errors.AppendFormat("{0} ", ex.Message); ex = ex.InnerException; } return(new ValidationResult { IsValid = false, ErrorMessage = errors.ToString() }); } finally { source.DisposeClient(); } }
public void WebSourceDisposeClientExpectedDisposesAndNullsClient() { var source = new WebSource { Client = new WebClient() }; Assert.IsNotNull(source.Client); source.DisposeClient(); Assert.IsNull(source.Client); }
public void WebSource_Dispose_Client_Expected_Disposes_And_Nulls_Client() { var source = new WebSource { Client = new WebClientWrapper() }; Assert.IsNotNull(source.Client); source.DisposeClient(); Assert.IsNull(source.Client); }