public void Should_set_properties_when_creating_unrecognised_status_exception() { var dummyResponse = new Response(HttpStatusCode.BadRequest, "Test Body"); var result = new UnrecognisedStatusException(dummyResponse); Assert.That(result.ResponseBody, Is.EqualTo(dummyResponse.Body)); Assert.That(result.StatusCode, Is.EqualTo(dummyResponse.StatusCode)); }
public void Should_round_trip_serialise_and_deserialise_exception() { var headers = new Dictionary <string, string> { { "Header1", "Header1Value" }, { "Header2", "Header2Value" } }; var response = new Response(HttpStatusCode.InternalServerError, headers, "responseBody"); var inputException = new UnrecognisedStatusException(response); var roundTripSerialiser = new RoundTripSerialiser(); var outputException = roundTripSerialiser.RoundTrip(inputException); Assert.That(outputException.Headers, Is.EqualTo(inputException.Headers)); Assert.That(outputException.ResponseBody, Is.EqualTo(inputException.ResponseBody)); Assert.That(outputException.StatusCode, Is.EqualTo(inputException.StatusCode)); Assert.That(outputException.Message, Is.EqualTo(inputException.Message)); }