public Maybe <IWebProxy> CreateProxy() { return(SystemWebProxyRetriever.GetSystemWebProxy() .Select(proxy => { proxy.Credentials = string.IsNullOrWhiteSpace(Username) ? CredentialCache.DefaultNetworkCredentials : new NetworkCredential(Username, Password); return proxy; })); }
public IEnumerable <EnvironmentVariable> GenerateEnvironmentVariables() { return(SystemWebProxyRetriever.GetSystemWebProxy() .SelectValueOr( proxy => { var proxyUri = proxy.GetProxy(TestUri); return ProxyEnvironmentVariablesGenerator.GetProxyEnvironmentVariables( proxyUri.Host, proxyUri.Port, Username, Password); }, Enumerable.Empty <EnvironmentVariable>() )); }