Example #1
0
        public void it_should_provide_problem_description()
        {
            var message   = "Test exception";
            var exception = MakeException(message);
            var response  = new ExceptionResponseInfo(new RequestInfo(Verb.GET, (HttpUrl)UrlParser.Parse("http://temp.uri/"), new MemoryStream(), new BasicClaimBasedIdentity()), exception);

            _converter.ConvertFrom(exception, response);
            response.Body.Seek(0, SeekOrigin.Begin);

            dynamic details = (JObject) new JsonSerializer().Deserialize(new JsonTextReader(new StreamReader(response.Body)));

            ((string)details.title).Should().Be(message);
            ((string)details.details).Should().NotBeNull();
            ((int)details.status).Should().Be((int)exception.Status);
        }