//GivenWhenThen public void GetData_WithUnauthorizedResponse_ShouldThrowException() { //arrange _restClient.Setup(x => x.ExecuteGetAsync(It.IsAny <RestRequest>(), default)).ReturnsAsync(UnauthorizedRestResponse()); //act //Action a =()=> _service.GetData(); //assert //Assert.AreEqual(); Assert.ThrowsAsync <ApplicationException>(() => _service.GetData()); }
private async Task RetrieveAndSend() { try { var data = await _dataProvider.GetData(); await _notifier.NotifySubscribers(data); } catch (Exception e) { _logger.LogError($"Something went wrong: \"{e.Message}\""); } }