public void FakeHttpserver_SingleRequest_ReturnsExpectedContent() { Server.LoadConfig(@"./TestAssets/testCase1.json"); Server.Run(); var client = new HttpClient(); client.BaseAddress = new System.Uri("http://localhost:5099/test"); client.DefaultRequestHeaders.Add("Accept", "application/json"); var content = new StringContent("{'data': 'test'}"); var result = client.PostAsync(client.BaseAddress, content).Result; Assert.Equal(200, (int)result.StatusCode); var respContent = result.Content.ReadAsStringAsync().Result; Assert.NotNull(respContent); Assert.Equal("THIS IS A TEST!", respContent); }
public void FakeHttpServer_CanLoadConfigFromFile() { Server = new FakeHttpServer(Port); Server.LoadConfig(@"./TestAssets/testCase1.json"); Assert.Single(Server.Config); }