DisposeClient() public method

public DisposeClient ( ) : void
return void
Exemplo n.º 1
0
        public void WebSourceDisposeClientExpectedDisposesAndNullsClient()
        {
            var source = new WebSource { Client = new WebClient() };

            Assert.IsNotNull(source.Client);
            source.DisposeClient();
            Assert.IsNull(source.Client);
        }
Exemplo n.º 2
0
        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();
            }
        }