public void Setup() { _request = _fixture.Create <ApplicationApprovedRequest>(); _mediator = new Mock <IMediator>(); _controller = new FunctionsController(_mediator.Object, Mock.Of <Microsoft.Extensions.Logging.ILogger <FunctionsController> >()); }
public async Task <IActionResult> ApplicationApproved(ApplicationApprovedRequest request) { try { var result = await _mediator.Send(new DebitPledgeCommand { PledgeId = request.PledgeId, Amount = request.Amount, ApplicationId = request.ApplicationId }); if (!result.StatusCode.IsSuccess()) { _logger.LogError($"Error attempting to Debit Pledge {result.ErrorContent}"); } return(new StatusCodeResult((int)result.StatusCode)); } catch (Exception e) { _logger.LogError(e, $"Error attempting to Debit Pledge"); return(new StatusCodeResult((int)HttpStatusCode.InternalServerError)); } }