public void then_should_throw_expected_exception() { CommunicationException exception = null; try { SUT.VerifyResponse <ExampleModel>(restResponse); } catch (CommunicationException ex) { exception = ex; } exception.ShouldNotBeNull(); exception.Message.ShouldEqual("Error occured while posting message 'test error'"); }
public void then_should_throw_expected_exception() { CommunicationException exception = null; try { SUT.VerifyResponse <ExampleModel>(restResponse); } catch (CommunicationException ex) { exception = ex; } string expectedMessage = $"Error occured while sending message '{restResponse.StatusCode}'"; exception.ShouldNotBeNull(); exception.Message.ShouldEqual(expectedMessage); }