public void CanEnumerateInterceptors() { // Arrange ResponseInterceptorSet.Add("X", new SomeInterceptor()); ResponseInterceptorSet.Add("Y", new SomeInterceptor()); IResponseInterceptor x = null; IResponseInterceptor y = null; // Act foreach (KeyValuePair <string, IResponseInterceptor> i in ResponseInterceptorSet) { if (i.Key == "X") { x = i.Value; } else if (i.Key == "Y") { y = i.Value; } } // Assert Assert.IsNotNull(x); Assert.IsNotNull(y); }
public void WhenNotFindingInterceptorItReturnsNull() { // Act IResponseInterceptor i = ResponseInterceptorSet.Find("Y"); // Assert Assert.IsNull(i); }
public HttpClientBuilder RegisterInterceptor(IResponseInterceptor interceptor) { if (_responseInterceptors == null) { _responseInterceptors = new List <IResponseInterceptor>(); } _responseInterceptors.Add(interceptor); return(this); }
public void CanAddAndGetInterceptor() { // Act ResponseInterceptorSet.Add("X", new SomeInterceptor()); IResponseInterceptor i = ResponseInterceptorSet.Find("X"); // Assert Assert.IsNotNull(i); }
public void Register(Regex urlPattern, IResponseInterceptor responseInterceptor) { if (this.interceptors.ContainsKey(urlPattern)) { this.interceptors[urlPattern].Add(responseInterceptor); } else { this.interceptors.Add(urlPattern, new List <IResponseInterceptor>() { responseInterceptor }); } }
public void Register(string url, IResponseInterceptor responseInterceptor) { Register(new Regex(url), responseInterceptor); }