/// <summary> /// Constructs a new instance of FilteredHttpTestSetup. /// </summary> /// <param name="settings">FlurlHttpSettings used in fake calls.</param> /// <param name="urlPatterns">URL(s) or URL pattern(s) that this HttpTestSetup applies to. Can contain * wildcard.</param> public FilteredHttpTestSetup(TestFlurlHttpSettings settings, params string[] urlPatterns) : base(settings) { if (urlPatterns.Any()) { With(call => urlPatterns.Any(p => Util.MatchesPattern(call.FlurlRequest.Url, p))); } }
/// <summary> /// Initializes a new instance of the <see cref="HttpTest"/> class. /// </summary> /// <exception cref="Exception">A delegate callback throws an exception.</exception> public HttpTest() { Settings = new TestFlurlHttpSettings(); ResponseQueue = new Queue <HttpResponseMessage>(); CallLog = new List <HttpCall>(); _httpClient = new Lazy <HttpClient>(() => Settings.HttpClientFactory.CreateHttpClient(HttpMessageHandler)); _httpMessageHandler = new Lazy <HttpMessageHandler>(() => Settings.HttpClientFactory.CreateMessageHandler()); SetCurrentTest(this); }
/// <summary> /// Constructs a new instance of HttpTestSetup. /// </summary> /// <param name="settings">FlurlHttpSettings used in fake calls.</param> protected HttpTestSetup(TestFlurlHttpSettings settings) { Settings = settings; }