public async void PutAsync_WithException_MustThrowException() { var token = TokenBuilder.Create().Build(); var requestUri = "someDummyUrl"; var exception = new Exception("Some dummy exception"); var httpClient = HandlerBuilder.Create().WithException(exception).Build(); var client = new OneDriveClient(token, httpClient); var expected = exception; var value = await Assert.ThrowsAsync <Exception>(async() => await client.PutAsync(requestUri, new StringContent(""))); Assert.NotNull(value); Assert.Equal(expected.Message, value.Message); }