public static void AddLoginExceptionExpectation(IWebRequestHelper webRequestHelper, Exception exceptionToThrow) { Expect.Call(delegate { webRequestHelper.Login(null); }) .IgnoreArguments() .Constraints(Is.TypeOf <Configuration>()) .Throw(exceptionToThrow); }
internal override void OnInitialization() { base.OnInitialization(); _helper = Helper as IWebRequestHelper; _helper.OnInitialization(); }
private async Task <string> GetPageContent(string url) { IWebRequestHelper webRequestHelper = ServiceLocator.Current.GetInstance <IWebRequestHelper>(); IWebCache webCache = ServiceLocator.Current.GetInstance <IWebCache>(); ICacheItem cacheItem = await webCache.Get(url, TimeSpan.FromDays(CacheDurationDays), k => { return(webRequestHelper.GetDataAsync(url, null, null, 30000, null, new Dictionary <HttpRequestHeader, string> { { HttpRequestHeader.Accept, "application/json" } })); }); if (cacheItem == null) { return(null); } if (cacheItem.Data == null) { return(null); } return(cacheItem.GetUTF8()); }
public AuthHelper( string autharizationApiUrl, IWebRequestHelper webRequestHelper) { this.autharizationApiUrl = autharizationApiUrl; this.webRequestHelper = webRequestHelper; }
public static void AddSearchExpectation(IWebRequestHelper webRequestHelper, string licenseExpected, string rawResponse) { Expect.On(webRequestHelper) .Call(webRequestHelper.Search(null, null)) .IgnoreArguments() .Constraints(Is.Equal(licenseExpected), Is.TypeOf <Configuration>()) .Return(rawResponse); }
public MainWindow() { InitializeComponent(); _webRequestHelper = new WebRequestHelper(); _cdoMHTMLHelper = new CDOMHTMLHelper(_webRequestHelper); _mailMHTMLHelper = new MailMHTMLHelper(_webRequestHelper); }
public ErrorLogDownloader(NetworkConnection connection, IWebRequestHelper webRequst, IFileSystemHelper fileSystemHelper, ICsvParser csvParser, ISettingsManager settingsManager) { Connection = connection; _webRequst = webRequst; _fileSystemsHelper = fileSystemHelper; _csvParser = csvParser; _settingsManager = settingsManager; ResolveDownloadDirectory(); }
public string Search(IWebRequestHelper webRequestHelper, string licenseNumber) { try { webRequestHelper.Search(licenseNumber, _config); return("success"); } catch (Exception ex) { return(ex.Message); } }
public string LoginHttp(IWebRequestHelper webRequestHelper) { try { webRequestHelper.Login(_config); return("success"); } catch (ArgumentException ex) { throw new ArgumentException(ex.Message); } }
public TeamCity(IConfiguration configuration, IWebRequestHelper webRequestHelper) { this._configuration = configuration; this._webRequestHelper = webRequestHelper; this._log = LoggingProvider.GetLogger <TeamCity>(); this._buildIdRegex = new Regex(configuration.ChangeProviderConfiguration.BuildIdFormat, RegexOptions.Compiled); if (!string.IsNullOrEmpty(configuration.ChangeProviderConfiguration.IssueFormat)) { this._log.Info("Compiling the following regex: " + configuration.ChangeProviderConfiguration.IssueFormat); this._issueIdRegex = new Regex(configuration.ChangeProviderConfiguration.IssueFormat); } }
public string LoginAndTest(IWebRequestHelper webRequestHelper) { try { webRequestHelper.Login(_config); webRequestHelper.Test(); return("success"); } catch (Exception ex) { return(ex.Message); } }
public UsNavalSolarAltitudeService(TraceWriter tracer, IWebRequestHelper requestHelper, bool testMode = false) { Debug.Assert(requestHelper != null); _testMode = testMode; _tracer = tracer; _requestHelper = requestHelper; _lineParseRegex = new Regex(@"^\s*(?<time>\d\d\:\d\d)\s+(?<alt>\-?\d+(\.\d+)?)", RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture | RegexOptions.Multiline); Throttle = testMode ? 0 : 1; }
public UrlStatusService(IWebRequestHelper webRequestHelper, ICacheHelper cacheHelper) { if (webRequestHelper == null) { throw new ArgumentNullException(nameof(webRequestHelper)); } if (cacheHelper == null) { throw new ArgumentNullException(nameof(cacheHelper)); } _webRequestHelper = webRequestHelper; _statusCache = cacheHelper; }
public CDOMHTMLHelper(IWebRequestHelper webRequestHelper) { _webRequestHelper = webRequestHelper; }
public Bills(IWebRequestHelper webRequestHelper) : base(webRequestHelper) { }
public void Dispose(IWebRequestHelper webRequestHelper) { webRequestHelper.Dispose(); }
public VkAPI(string appId, string appSecret, IWebRequestHelper webRequest) { this.appId = appId; this.appSecret = appSecret; this.webRequest = webRequest; }
public static void AddTestExpectation(IWebRequestHelper webRequestHelper) { Expect.Call(() => webRequestHelper.Test()).IgnoreArguments(); }
public string MakeWebRequestCall(IWebRequestHelper webServiceHelper, HttpWebRequest webRequest, string request) { string returnString = webServiceHelper.GetResponse(webRequest, request); return(returnString); }
public void Test(IWebRequestHelper webRequestHelper) { webRequestHelper.Test(); }
public CoordinatesService(IWebRequestHelper web) { this.web = web; }
protected override void OnRuntimeEnable() { base.OnRuntimeEnable(); _webRequestHelper = Target.GetType().GetField("_helper", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(Target) as IWebRequestHelper; }
public WebDictionaryRequestHelper(IWebRequestHelper webRequestHelper) { _webRequestHelper = webRequestHelper; }
public static void AddDisposeExpectation(IWebRequestHelper webRequestHelper) { Expect.Call(delegate { webRequestHelper.Dispose(); }) //delegate needed since it is a void method .IgnoreArguments().Constraints(); }
public static void AddLoginExpectation(IWebRequestHelper webRequestHelper, Configuration config) { Expect.Call(() => webRequestHelper.Login(config)) .IgnoreArguments() .Constraints(Is.TypeOf <Configuration>()); }
public BillingApi(IWebRequestHelper webRequestHelper) { _bills = new Bills(webRequestHelper); }
public FacebookAPI(string appId, string appSecret, IWebRequestHelper webRequest) { this.appId = appId; this.appSecret = appSecret; }
public ItemsAPI(IWebRequestHelper webRequestHelper, string authToken) { this.webRequestHelper = webRequestHelper; this.authToken = authToken; }
protected override void OnRuntimeEnable() { base.OnRuntimeEnable(); _webRequestHelper = _helper as IWebRequestHelper; }
public AuthorizationAPI(IWebRequestHelper webRequestHelper) { this.webRequestHelper = webRequestHelper; }
public AuthorizeController(IWebRequestHelper helper, IOptions <SMApiConfigurationModel> smApiConfigModel) { _helper = helper; _smApiConfigModel = smApiConfigModel.Value; }
/// <summary> /// 设置网页请求帮助类 /// </summary> /// <param name="helper"></param> public void SetWebRequestHelper(IWebRequestHelper helper) { _webRequestHelper = helper; }
public static void AddHttpRequestExpectation(IWebRequestHelper webRequestHelper, HttpWebRequest httpRequest, string request, string response) { Expect.On(webRequestHelper).Call(webRequestHelper.GetResponse(httpRequest, request)).Return(response); }