public void GetThing_WhenTheThingExists_ReturnTheThing() { MockProviderService.Given("There is a thing") .UponReceiving("A GET request to retrieve the thing") .With(new ProviderServiceRequest { Method = HttpVerb.Get, Path = "/api/values/", Headers = new Dictionary <string, object> { { "Accept", "application/json" } } //Query = "" }) .WillRespondWith(new ProviderServiceResponse { Status = 200, Headers = new Dictionary <string, object> { { "Content-Type", "application/json; charset=utf-8" } }, Body = new //NOTE: Note the case sensitivity here, the body will be serialised as per the casing defined { value1 = "value1", value2 = "value2" } }); //NOTE: WillRespondWith call must come last as it will register the interaction var response = ApiTestClient.MakeRequest(HttpMethod.Get, "http://localhost:9222/api/values"); var content = ApiTestClient.HttpResponseToString(response); Assert.IsNotNull(content); }
public HomeControllerTests() { _apiTestClient = new ApiTestClient(HttpClient); }
public BookingControllerTests() { _apiTestClient = new ApiTestClient(HttpClient); }