How to unit test a method with HttpWebRequest/Response dependencies
问题 Been trying to unit test this method but can't figure out how to do it. public bool ValidateCaptcha(string captchaResponse, string captchaChallenge, string hostip) { var strPrivateKey = _secConfiguration.CaptchaPrivateKey; var strParameters = "verify?privatekey=" + strPrivateKey + "&remoteip=" + hostip + "&challenge=" + captchaChallenge+ "&response=" + captchaResponse; var url = CaptchaUrl + strParameters; var request = CreateHttpWebRequest(url); request.Proxy.Credentials = CredentialCache