public void Can_Handle_Exception_from_AlwaysThrowsList_with_GET_route() { var client = CreateNewServiceClient(); if (client is WcfServiceClient) { return; } try { var response = client.Get <List <AlwaysThrows> >("/throwslist/404/{0}".Fmt(TestString)); Assert.Fail("Should throw HTTP errors"); } catch (WebServiceException webEx) { Assert.That(webEx.StatusCode, Is.EqualTo(404)); var response = (ErrorResponse)webEx.ResponseDto; var expectedError = AlwaysThrowsService.GetErrorMessage(TestString); Assert.That(response.ResponseStatus.ErrorCode, Is.EqualTo(typeof(NotImplementedException).Name)); Assert.That(response.ResponseStatus.Message, Is.EqualTo(expectedError)); } }
public void Can_Handle_Exception_from_AlwaysThrowService() { string result; var responseStatus = client.AlwaysThrows(out result, TestString); var expectedError = AlwaysThrowsService.GetErrorMessage(TestString); Assert.That(responseStatus.ErrorCode, Is.EqualTo(typeof(NotImplementedException).Name)); Assert.That(responseStatus.Message, Is.EqualTo(expectedError)); }
public void Can_Handle_Exception_from_AlwaysThrowService() { var client = CreateNewServiceClient(); var response = client.Send <AlwaysThrowsResponse>( new AlwaysThrows { Value = TestString }); var expectedError = AlwaysThrowsService.GetErrorMessage(TestString); Assert.That(response.ResponseStatus.ErrorCode, Is.EqualTo(typeof(NotImplementedException).Name)); Assert.That(response.ResponseStatus.Message, Is.EqualTo(expectedError)); }
public void Can_Handle_Exception_from_AlwaysThrowService() { var client = CreateNewServiceClient(); try { var response = client.Send <AlwaysThrowsResponse>( new AlwaysThrows { Value = TestString }); Assert.Fail("Should throw HTTP errors"); } catch (WebServiceException webEx) { var response = (AlwaysThrowsResponse)webEx.ResponseDto; var expectedError = AlwaysThrowsService.GetErrorMessage(TestString); Assert.That(response.ResponseStatus.ErrorCode, Is.EqualTo(typeof(NotImplementedException).Name)); Assert.That(response.ResponseStatus.Message, Is.EqualTo(expectedError)); } }