using Jackett.Utils.Clients; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace JackettTest { public class TestWebClient : IWebClient { private Dictionary> byteCallbacks = new Dictionary>(); private Dictionary> stringCallbacks = new Dictionary>(); public void RegisterByteCall(WebRequest req, Func f) { byteCallbacks.Add(req, f); } public void RegisterStringCall(WebRequest req, Func f) { stringCallbacks.Add(req, f); } public Task GetBytes(WebRequest request) { return Task.FromResult< WebClientByteResult>(byteCallbacks.Where(r => r.Key.Equals(request)).First().Value.Invoke(request)); } public Task GetString(WebRequest request) { return Task.FromResult(stringCallbacks.Where(r => r.Key.Equals(request)).First().Value.Invoke(request)); } public void Init() { } } }