Пример #1
0
        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);
        }
Пример #2
0
        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");
        }
Пример #3
0
        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);
        }
Пример #4
0
 private MappingInfoViewModel GivenAMapping(MappingForTest mapping)
 {
     return(GivenAMappingWith(_httpMethod, mapping));
 }