public void Can_Handle_Exception_from_AlwaysThrowsList_with_GET_route() { var client = CreateNewServiceClient(); #if !NETCORE if (client is WcfServiceClient) { return; } #endif 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 responseDto = (ErrorResponse)webEx.ResponseDto; Assert.That(responseDto.ResponseStatus.ErrorCode, Is.EqualTo(typeof(NotImplementedException).Name)); Assert.That(responseDto.ResponseStatus.Message, Is.EqualTo(AlwaysThrowsService.GetErrorMessage(TestString))); } }
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 responseDto = (AlwaysThrowsResponse)webEx.ResponseDto; Assert.That(responseDto.ResponseStatus.ErrorCode, Is.EqualTo(typeof(NotImplementedException).Name)); Assert.That(responseDto.ResponseStatus.Message, Is.EqualTo(AlwaysThrowsService.GetErrorMessage(TestString))); } }