public static FakeResponseHandler CompressAndFail(this FakeResponseHandler fakeResponse) { var errorApiObject = new Way2enjoyApiException(400, "reason", "title", "message"); var compressResponseMessage = new HttpResponseMessage { StatusCode = System.Net.HttpStatusCode.BadRequest, Content = new StringContent(JsonConvert.SerializeObject(errorApiObject)) }; fakeResponse.AddFakePostResponse(new Uri("https://way2enjoy.com/modules/compress-png/way2enjoy-cli2.php"), compressResponseMessage); return(fakeResponse); }
public void Way2enjoyExceptionPopulatesCorrectData() { var StatusCode = 200; var StatusReasonPhrase = "status"; var ErrorTitle = "title"; var ErrorMessage = "message"; var e = new Way2enjoyApiException(StatusCode, StatusReasonPhrase, ErrorTitle, "message"); var msg = $"Api Service returned a non-success status code when attempting an operation on an image: {StatusCode} - {StatusReasonPhrase}. {ErrorTitle}, {ErrorMessage}"; Assert.Equal(StatusCode, e.StatusCode); Assert.Equal(StatusReasonPhrase, e.StatusReasonPhrase); Assert.Equal(ErrorTitle, e.ErrorTitle); Assert.Equal(msg, e.Message); }