public void SetupServer(string baseUrl) { if (HttpMock == null) { HttpMock = new HttpMock(); HttpMock.Start(baseUrl); } }
public void SetupServer() { const string url = "http://localhost:8888/"; _httpMock = new HttpMock(); _httpMock.Start(url); _httpMock.Add("POST", UrlPath, (request, response) => { PathWasCalled = true; CallCount++; response.StatusCode = (int)HttpStatusCode.OK; }); }
static void Main() { HttpMock httpMock = new HttpMock(); httpMock.Start("http://localhost:8000/"); httpMock.Add("GET", "/test", (request, response) => { Thread.Sleep(3000); response.SetBody($"{request}\r\nFoo!"); }); httpMock.Add("GET", "/", (request, response) => response.SetBody($"{request}\r\nWoah!")); httpMock.Add((request, response) => response.SetBody($"{request}\r\rMini Wild!")); httpMock.Add("GET", "/test", (request, response) => response.SetBody($"{request}\r\nBOOO!")); Console.WriteLine("Enter to exit..."); Console.ReadLine(); }