public async Task Given_no_request_is_configured_and_custom_fallback_is_configured_to_throw_specific_exception_when_sending_request_should_throw() { var ex = new TestableException(); _sut.Fallback.Throws(ex); // Act Func <Task> act = () => _httpClient.GetAsync(""); // Assert (await act.Should().ThrowAsync <TestableException>()).Which.Should().Be(ex); }
public void Given_request_is_configured_to_throw_specific_exception_when_sending_request_should_throw_exception() { var exception = new TestableException(); _sut.When(matching => { }) .Throws(exception) .Verifiable(); // Act Func <Task <HttpResponseMessage> > act = () => _httpClient.GetAsync(""); // Assert act.Should() .Throw <TestableException>() .Which.Should() .Be(exception); _sut.Verify(m => { }, IsSent.Once); _sut.VerifyNoOtherRequests(); }