public void IfAHeaderIsConfigured_ShouldReturnTheConfiguredResponseHeader(string header, string value) { var mappingForTest = new MappingForTest(); mappingForTest.Headers.Add(header, value); var mapping = GivenAMapping(mappingForTest); var response = MakeHttpRequest(mapping.Path, mapping.RequestHttpMethod); response.Headers[header].Should().Be(value); }
public void IfMultipleHeadersAreConfigure_ShouldReturnTheConfiguredResponseHeaders() { var mappingForTest = new MappingForTest(); mappingForTest.Headers.Add("Cache-Control", "max-age=30"); mappingForTest.Headers.Add("Content-Type", "application/json"); var mapping = GivenAMapping(mappingForTest); var response = MakeHttpRequest(mapping.Path, mapping.RequestHttpMethod); response.Headers["Cache-Control"].Should().Be("max-age=30"); response.Headers["Content-Type"].Should().Be("application/json"); }
private MappingInfoViewModel GivenAMappingWith(HttpMethod requestHttpMethod, MappingForTest mapping) { var mappingInfoViewModel = new MappingInfoViewModel(A.Fake <IEditResponseWindowFactory>()) { Path = mapping.Path, RequestHttpMethod = requestHttpMethod, ResponseStatusCode = mapping.ResponseStatusCode, ResponseBody = mapping.ResponseBody, ResponseHeaders = mapping.Headers }; MockServer.UpdateMappings(new List <MappingInfoViewModel> { mappingInfoViewModel }); return(mappingInfoViewModel); }
private MappingInfoViewModel GivenAMapping(MappingForTest mapping) { return(GivenAMappingWith(_httpMethod, mapping)); }